home *** CD-ROM | disk | FTP | other *** search
/ Archive Magazine CD 1995 / Archive Magazine CD 1995.iso / discs / prog_disc / volume_1 / issue_08 / musiced (.txt) < prev    next >
Encoding:
RISC OS BBC BASIC V Source  |  1988-04-25  |  70.2 KB  |  2,968 lines

  1.  > &.MusicEd
  2.  (c) Acorn Computers 1987
  3.  Version 1.01
  4. error:
  5. INITIALISED%=
  6. initialise
  7. error
  8. PLAYING% B1%=B2%:
  9.  Sound_QBeat 
  10.  B2%:
  11. B2%<B1% 
  12. play_bar
  13. wimp_attended
  14. pointer_attended 
  15.  EXIT%
  16. wimp_attended
  17. terminate
  18.  SKS IFLENHost$ SYS OS_FSControl,0,Host_Dir$:CHAINHost$
  19. ("DIR &"):
  20. *DeskTop
  21. wimp_attended
  22. A%=%100000
  23.  Poll_Wimp,A%,Window+handle 
  24. redraw_window_request
  25. open_window_request
  26. close_window_request
  27. pointer_leaving_window
  28. mouse_button_click
  29. key_pressed
  30. pointer_attended
  31. >PTIME% 
  32. PTIME%=
  33. @"Imminent_KEY%+=Imminent_KEY%>0
  34. highlight_pointer
  35. SCORING% 
  36. symbol_pointer
  37. redraw_window_request
  38.  Redraw_Window,,Window+handle 
  39.  Window!handle 
  40.  Description_W%:
  41. draw_description
  42.  Score_W%:
  43. draw_staves
  44.  Confirm_W%:
  45. draw_confirmation
  46.  Get_Rectangle,,Window+handle 
  47. open_window_request
  48. release
  49.  Open_Window,,Window+handle
  50. close_window_request
  51.  W%,O%
  52. release
  53.  Window!handle 
  54.  Description_W%:O%=
  55. MH_Describe(O_Exit%)
  56.  Score_W%:
  57. close_window(Window!handle)
  58. X%O%=
  59. match_option(7,Window!handle)
  60. OO%=O%:O$=O$(O%)
  61. do_option(O_Exit%)
  62. match_menu(1,Window!handle)
  63. close_menu(O%)
  64. open_window(W%,U%)
  65. Window!handle=W%
  66.  Get_Window_State,,Window+handle
  67. Window!under=U%
  68.  Open_Window,,Window+handle
  69. move_window(W%,X%,Y%,U%)
  70. x%,y%
  71. Window!handle=W%
  72.  Get_Window_State,,Window+handle
  73.  #x%=X%-Window!x0:y%=Y%-Window!y1
  74. Window!x0+=x%:Window!x1+=x%
  75. Window!y0+=y%:Window!y1+=y%
  76. Window!under=U%
  77.  Open_Window,,Window+handle
  78. check_window(W%,U%)
  79. Window!handle=W%
  80.  Get_Window_State,,Window+handle
  81. Window?status 
  82. Window!under=U%:
  83.  Open_Window,,Window+handle
  84. close_window(W%)
  85. Window!handle=W%
  86.  Close_Window,,Window+handle
  87. pointer_leaving_window
  88. Window!handle=Confirm_W% 
  89. confirm(
  90. mouse_button_click
  91. B%,C%,W%,I%
  92. !W%=Mouse!window:I%=Mouse!icon
  93. 6B%=%111
  94. Mouse!buttons:C%=B%
  95. Mouse!old_buttons
  96. 'Mouse_X%=Mouse!x0:Mouse_Y%=Mouse!y0
  97. B%=%010
  98. C%=%010 
  99. W%=Confirm_W% 
  100. confirm(
  101. open_menu(Menu_Root%+1,
  102.  Score_W%
  103. B%=%100
  104. C%=%100
  105. SCORING%
  106. SCRIBE%(drawn%) 
  107. put_down 
  108. B%=%001
  109. C%=%001 
  110. play(
  111. release:SCORING%=
  112.  Confirm_W%:
  113. confirm(
  114.  Description_W%
  115. %101 
  116. release
  117. match_option(7,W%)
  118. B%=Adj%
  119. %1)>0
  120. ZOO%=O%:O$=O$(O%):
  121. I%>=0 
  122. select_item(B%
  123. set_option(O%(OO%,Menu%),O%(OO%,Option%))
  124. match_menu(1,W%)
  125. O% MO%=O%:
  126. I%>=0 
  127. select_option(I%+1)
  128. keyboard
  129. key_pressed
  130. *FX21,0
  131. PLAYING%
  132. Window!key=27 
  133. play(
  134. !Icon 
  135. input_key(Window!handle,!Icon,Window!key)
  136.  Window!handle 
  137.  Menu_W%(M%(MO%)):
  138. menu_key(Window!key)
  139.  List_W%(O%(OO%,List%)):
  140. list_key(Window!key)
  141.  Confirm_W%:
  142. confirm_key(Window!key)
  143. keyboard
  144. CONFIRM%>0 W%=Confirm_W% 
  145. OO% W%=List_W%(O%(OO%,List%)) 
  146. MO% W%=Menu_W%(M%(MO%))
  147. Set_Caret_Position,W%,
  148. ,,,&2000000
  149. keyoff
  150. Set_Caret_Position,
  151. highlight(W%,I%,S%)
  152. Window!handle=W%:!Icon=I%
  153. S% Icon!state=C_High<<28 
  154.  Get_Icon_Info,,Icon+handle:Icon!state=5-(Icon?23
  155. &F)<<27
  156. Icon!mask=&F0000000
  157.  Set_Icon_State,,Icon+handle
  158. select(W%,I%,S%)
  159. Window!handle=W%:!Icon=I%
  160. Icon!state=S%<>
  161. &200000
  162. Icon!mask=&200000
  163.  Set_Icon_State,,Icon+handle
  164. outline(W%,I%,S%)
  165. Window!handle=W%:!Icon=I%
  166. Icon!state=S%<>
  167. Icon!mask=%100
  168.  Set_Icon_State,,Icon+handle
  169. input_key(W%,I%,K%)
  170. match_option(7,W%)
  171. O$=O$(OO%)
  172. do_option(O_Exit%)
  173. do_option(I%)
  174.  138,139:
  175. do_option(I%):
  176. list_key(K%)
  177. menu_key(K%)
  178. Imminent_KEY%=
  179.  Get_Pointer_Info,,Mouse
  180. Mouse!buttons 
  181. close_menu(MO%)
  182. Menu_OPTION%(0) MO%=
  183. match_menu(0,Menu_OPTION%(0)):
  184. select_option(Menu_OPTION%(1))
  185. key_option(K%)
  186. match_option(6,K%)
  187. OO%=L%
  188. O$=O$(OO%)
  189. set_option(O%(OO%,Menu%),O%(OO%,Option%))
  190. open_window(List_W%(O%(OO%,List%)),-1)
  191. keyboard
  192. highlight_option(K%)
  193. describe(0,K%)
  194. Imminent_KEY%=15
  195. list_key(K%)
  196. Imminent_KEY%>0
  197. Imminent_KEY%=
  198. menu_key(K%)
  199. S%,L%,I%,V%
  200. release
  201. do_option(O_Exit%)
  202. O%(OO%,Item%)>=0 
  203. select_item(O%(OO%,Item%)
  204. SCORING%)
  205.  136,137,138,139
  206. p%L%=O%(OO%,List%):I%=O%(OO%,Item%)
  207. K%>137 K%=
  208. (138.5-K%) 
  209. (K%-136.5)*(List_Items%(L%)
  210. List_Columns%(L%)+1)
  211. I%>=0 S%=SCORING%
  212. O%(OO%,State%)<>0
  213. List_Flag%(L%,I%)
  214. S% I%=
  215. bit(O%(OO%,State%))
  216. I%+=K%
  217.  V%=I%>=0
  218. I%<=List_Items%(L%)
  219. List_Select%(L%)
  220. %1<<I%
  221. outline_item(I%):
  222. describe(1,I%):List_KEY%=
  223. do_option(I%)
  224. K%>48
  225. K%<58 
  226. I%=(K%
  227. &F)-1
  228. I%>=0
  229. I%<=List_Items%(O%(OO%,List%)) 
  230. describe(1,I%):
  231. select_item(I%):List_KEY%=
  232. menu_key(K%)
  233. describe(S%,N%)
  234.  S%=0 O%=M%(MO%) 
  235. O%=O%(OO%,List%)
  236. O%>0 
  237. O%<>DESCRIPTION%(0) 
  238.  N%<>DESCRIPTION%(2) DESCRIPTION%(0)=O%:DESCRIPTION%(1)=S%:DESCRIPTION%(2)=N%:
  239. new_description
  240. new_description
  241. DESCRIBING% 
  242.  R%,C%
  243.     ~ Window!handle=Description_W%
  244. OWindow!x0=0:Window!y0=-C_Height%-Vi%*2:Window!x1=S_Width%-Hi%*2:Window!y1=0
  245.  Update_Window,,Window+handle 
  246. &DL%=(Window!x1-Window!x0)/C_Width%
  247. draw_description
  248.  Get_Rectangle,,Window+handle 
  249. draw_description
  250.  DN$,D$
  251. O%=DESCRIPTION%(2)
  252.  DESCRIPTION%(1) 
  253. O% O%=
  254. option_n(DESCRIPTION%(0),O%)+1 
  255. menu_name(DESCRIPTION%(0))-1
  256. menu_OPTION(O%+1)+": "
  257. ?O% D$=Menu_Description$(?O%)
  258. List_Flag%(DESCRIPTION%(0),O%)
  259. (List_Flag%(DESCRIPTION%(0),O%)
  260. &F000)=&F000 
  261. DN$=List_Item$(DESCRIPTION%(0),O%)+": "
  262. Z,D$=List_Description$(DESCRIPTION%(0),O%)
  263. print(Window!x0-Window!scx,Window!y1-C_Height%-2*Vi%," "+DN$+D$,DL%)
  264. open_menu(M%,P%)
  265. match_menu(0,M%)
  266. MOP%+=1:M%(MOP%)=M%:MO%=MOP%
  267. Window!handle=Menu_W%(M%)
  268.  Get_Window_State,,Window+handle
  269. 'T%=Mouse_X%-(Window!x0+Window!x1)
  270. Window!x0+=T%:Window!x1+=T%
  271. T%=Mouse_Y%-Window!y1
  272. Window!y0+=T%:Window!y1+=T%
  273. Window!under=-1
  274.  Open_Window,,Window+handle
  275. Menu_BASE%(M%)>0 P%=
  276. match_option(6,Menu_BASE%(M%)):
  277. P% OO%=P%:O$=O$(OO%)
  278. keyboard
  279. close_menu(H%)
  280. keyoff
  281. M%:M%=M%(H%)
  282. close_window(Menu_W%(M%(H%)))
  283. M%(H%)=M%(MOP%)
  284. MOP%-=1
  285. MO%>MOP% MO%=MOP%
  286. Menu_BASE%(M%(MO%))>0 M%=
  287. match_option(6,Menu_BASE%(M%(MO%))):
  288. M% OO%=M%:O$=O$(OO%)
  289. keyboard
  290. match_menu(T%,V%)
  291. H%=MOP%
  292. Menu_W%(M%(H%))<>V%
  293. H%:H%+=
  294. M%(H%)<>V%
  295. H%:H%+=
  296. select_option(O%)
  297.  P%,o%
  298. Imminent_KEY%=
  299. option_n(M%(MO%),O%)
  300. ?P%=0 
  301. set_option(M%(MO%),O%)
  302. match_option(6,O%)
  303. OO% O$=O$(OO%):
  304. open_window(List_W%(O%(OO%,List%)),-1) 
  305. name_option(M%(MO%),P%+2):CONFIRM%=
  306. do_option(O_Entry%)
  307. keyboard
  308. &    OO%=0
  309. open_menu(?P%,
  310. option_n(M%,N%)
  311. P%=MP%(M%)
  312. N%>0 
  313. N%=N%
  314. -1:P%+=
  315. $P%,Sep$):
  316. set_option(M%,O%)
  317. Menu_BASE%(M%)<>O% 
  318. U%=Menu_BASE%(M%)
  319. select(Menu_W%(M%),O%-1,
  320. select(Menu_W%(M%),U%-1,
  321. Menu_BASE%(M%)=O%
  322. key_option(C%)
  323. alphanumeric(C%)
  324. C%<0 
  325. P%,I%
  326. F%,O%
  327. P%=MP%(M%(MO%)):I%=2
  328. *    O%+=1
  329. P%+=I%
  330. $P%,Sep$,3)
  331. C%,3)
  332.  P%?I%=13 
  333. F%<I%
  334. F%<I% 
  335. name_option(M%,P%)
  336. I%,N$
  337. N$="_"+
  338. menu_option(P%)
  339. $I%=?
  340. menu_name(M%):
  341. I%>96 I%-=32
  342. I%+N$
  343. M%=?MP%(M%)
  344. M%=Menu_Root%
  345. ="FN"+N$+"(R%)"
  346. do_option(R%)
  347. play(
  348. PLAYING%)
  349. highlight_option(O%)
  350.  M%(MO%)<>Menu_OPTION%(0) 
  351.  O%<>Menu_OPTION%(1) 
  352. Menu_OPTION%(0) 
  353. highlight(Menu_W%(Menu_OPTION%(0)),Menu_OPTION%(1)-1,
  354. O%>0 Menu_OPTION%(0)=M%(MO%):Menu_OPTION%(1)=O%:
  355. highlight(Menu_W%(Menu_OPTION%(0)),O%-1,
  356. ):List_KEY%=
  357. Menu_OPTION%(0)=0
  358. select_item(I%)
  359. i%:i%=I%
  360. Adj%+
  361. List_Select%(O%(OO%,List%))
  362. %1<<i% 
  363. outline_item(i%):
  364. do_option(I%)
  365. open_option(L%)
  366. assert(OOP%<Max_Option%,"Available space in options open table") 
  367. OOP%+=1
  368. OO%=OOP%
  369. O%(OO%,Menu%)=M%(MO%)
  370. t'O%(OO%,Option%)=Menu_BASE%(M%(MO%))
  371. O%(OO%,Item%)=
  372. O%(OO%,List%)=L%
  373. O%(OO%,State%)=
  374. O$(OO%)=O$
  375.  Y%,T%
  376. "Window!handle=Menu_W%(M%(MO%))
  377.  Get_Window_State,,Window+handle
  378. Y%=Window!y0-B_Height%+Vi%
  379. Window!handle=List_W%(L%)
  380.  Get_Window_State,,Window+handle
  381. 'T%=Mouse_X%-(Window!x0+Window!x1)
  382. Window!x0+=T%:Window!x1+=T%
  383. T%=Y%-Window!y1
  384. Window!y0+=T%:Window!y1+=T%
  385. Window!under=-1
  386.  Open_Window,,Window+handle
  387. list_set(List_STATE%(L%),
  388. outline_item(
  389. bit(List_Select%(L%)))
  390. close_option
  391. keyoff
  392. L%,I%,M%
  393. L%=O%(OO%,List%)
  394. close_window(List_W%(L%))
  395. outline_item(
  396. M%=O%(OO%,Menu%)
  397. Menu_BASE%(M%)=O%(OO%,Option%) 
  398. set_option(M%,0)
  399. "List_STATE%(L%)=O%(OO%,State%)
  400.  I%=0
  401. 4:O%(OO%,I%)=O%(OOP%,I%):
  402. O$(OO%)=O$(OOP%):OOP%-=1
  403. Menu_BASE%(M%)>0
  404. M%=M%(MO%) OO%=
  405. match_option(6,Menu_BASE%(M%)) 
  406. match_option(Menu%,M%)
  407. O$=O$(OO%)
  408. set_option(M%,O%(OO%,Option%))
  409. keyboard
  410. match_option(T%,V%)
  411. O%=OOP%
  412. Menu_W%(O%(O%,Menu%))<>V%
  413. O%:O%+=
  414. (O%(O%,Menu%)<>M%(MO%)
  415. O%(O%,Option%)<>V%)
  416. O%:O%+=
  417. List_W%(O%(O%,List%))<>V%
  418. O%:O%+=
  419. O%(O%,T%)<>V%
  420. O%:O%+=
  421. list_set(S%,M%,N%)
  422. (O%(OO%,State%)
  423. S%)=S% S%=O%(OO%,State%)
  424. S%=O%(OO%,State%)
  425. C%=(O%(OO%,State%)
  426. C% O%(OO%,State%)=
  427. set_list(O%(OO%,List%),C%,S%)
  428. list_reset(L%,S%)
  429. match_option(List%,L%)
  430. O% O%(O%,State%)=
  431. set_list(L%,O%(O%,State%)
  432. S%,S%) 
  433. List_STATE%(L%)=
  434. set_list(L%,List_STATE%(L%)
  435. S%,S%)
  436. set_list(L%,C%,S%)
  437. (%1<<B%-
  438. )<=C%
  439. %1<<B%
  440. highlight(List_W%(L%),B%,S%
  441. %1<<B%)
  442. outline_item(I%)
  443. I%<>O%(OO%,Item%) 
  444. O%(OO%,Item%)>=0 
  445. outline(List_W%(O%(OO%,List%)),O%(OO%,Item%),
  446. I%>=0 O%(OO%,Item%)=I%:
  447. outline(List_W%(O%(OO%,List%)),I%,
  448. O%(OO%,Item%)=-1
  449. confirm(C%)
  450. CONFIRM%=C%
  451.  1,2,3
  452.  Get_Pointer_Info,,Mouse
  453. l'Mouse_X%=Mouse!x0:Mouse_Y%=Mouse!y0
  454. Window!handle=Confirm_W%
  455. CWindow!x0=Mouse_X%-4.5*C_Width%:Window!x1=Mouse_X%+4.5*C_Width%
  456. AWindow!y0=Mouse_Y%-2*C_Height%:Window!y1=Mouse_Y%+2*C_Height%
  457. -Window!scx=0:Window!scy=0:Window!under=-1
  458.  Open_Window,,Window+handle
  459. close_window(Confirm_W%)
  460. do_option(O_Exit%)
  461. close_window(Confirm_W%)
  462. do_option(O_Entry%)
  463. keyboard
  464. draw_confirmation
  465. 4,Window!x0+C_Width%
  466. 2,Window!y1-5*Vi%
  467.  CONFIRM% 
  468. "Abandon"
  469. BYC_Width%
  470. "current"
  471. BYC_Width%
  472. "score?"
  473. "Replace"
  474. BYC_Width%
  475. "existing"
  476. BYC_Width%
  477. "file?"
  478. "  Are"
  479. BYC_Width%
  480. "  you"
  481. BYC_Width%
  482. "  sure?"
  483. confirm_key(K%)
  484. Imminent_KEY%=
  485. confirm(
  486. confirm(
  487. highlight_pointer
  488. W%,I%,O%
  489.  Get_Pointer_Info,,Mouse
  490. !W%=Mouse!window:I%=Mouse!icon
  491. match_menu(1,W%)
  492. MO%:MO%=O%
  493. I%>=0 I%+=1:
  494. highlight_option(I%):
  495. List_KEY% 
  496. describe(0,I%)
  497. match_option(7,W%)
  498. OO%:OO%=O%
  499. I%>=0 
  500.  List_Select%(O%(OO%,List%))
  501. %1<<I% 
  502. outline_item(I%):
  503. describe(1,I%):List_KEY%=
  504. Imminent_KEY% 
  505. highlight_option(-1)
  506. Imminent_KEY% 
  507. highlight_option(-1):
  508. List_KEY% 
  509. describe(0,Menu_BASE%(M%(MO%)))
  510. CONFIRM%>0 
  511. W%<>Confirm_W% 
  512. confirm(
  513. symbol_pointer
  514.  Get_Pointer_Info,,Mouse
  515. Mouse!window=Score_W%
  516. Mouse!buttons=
  517. scribe(Mouse!x0,Mouse!y0)
  518. M_eXit(R%)
  519.  O_Entry%
  520. CONFIRM%=
  521.  CHANGED%=
  522. EXIT%=
  523. set_option(M%(MO%),0)
  524. confirm(1)
  525.  O_Exit%:
  526. set_option(M%(MO%),0)
  527. MH_Describe(R%)
  528.  O_Entry%
  529. open_window(Description_W%,-1)
  530. DESCRIBING%=
  531. set_option(M%(MO%),0)
  532.  O_Exit%
  533. close_window(Description_W%)
  534. DESCRIBING%=
  535.  O_Initialise%
  536. define_window(0,0,S_Width%-Hi%*2,C_Height%+Vi%*2,&B,
  537. ,"DESCRIBE",C_Text,C_Menu,C_Music,C_Bkgd)
  538.  Create_Window,,Window 
  539.  Description_W%
  540. DESCRIBING%=
  541. &DL%=(Window!x1-Window!x0)
  542. C_Width%
  543. MS_Clear(R%)
  544.  O_Entry%
  545. CONFIRM%=
  546.  CHANGED%=
  547. GATE%=MUSIC%+2
  548. FINE%()=MUSIC%()
  549. PP%=MUSIC%:P%()=MUSIC%()
  550. start_music
  551. rescore(0)
  552. CHANGED%=
  553. set_option(M%(MO%),0)
  554. confirm(1)
  555.  O_Exit%:
  556. set_option(M%(MO%),0)
  557. MS_Volume(R%)
  558. R%>=0 
  559. R%=R%
  560. list_set(%1<<R%,&7FFF,&7FFF)
  561. Volume%=R%
  562.  Sound_Volume,Volume%(Volume%)
  563.  O_Entry%:
  564. open_option(Volume_list%)
  565.  O_Exit%:
  566. close_option
  567.  O_Initialise%
  568. NVolumes%=8
  569.  Volume%(NVolumes%),Volumes%(7)
  570. NVolumes%
  571. :*Volume%(R%)=(R%+1)*128/(NVolumes%+1)-1
  572. N)Volume_list%=
  573. define_list("VOLUME",1)
  574. list_item("Pianississimo:As softly as possible ("+
  575. Volume%(0)+")",&3131)
  576. list_item("Pianissimo:Very Softly ("+
  577. Volume%(1)+")",&3031)
  578. list_item("Piano:Softly ("+
  579. Volume%(2)+")",&3031)
  580. list_item("Mezzo-Piano:Moderately softly ("+
  581. Volume%(3)+")",&3031)
  582. list_item("Mezzo:Medium ("+
  583. Volume%(4)+")",&3031)
  584. list_item("Mezzo-Forte:Moderately loud ("+
  585. Volume%(5)+")",&3031)
  586. list_item("Forte:Loudly ("+
  587. Volume%(6)+")",&3031)
  588. list_item("Fortissimo:Very loudly ("+
  589. Volume%(7)+")",&3031)
  590. list_item("Fortississimo:As loudly as possible ("+
  591. Volume%(8)+")",&3131)
  592. end_list(Volume_list%)
  593.  Sound_Volume 
  594. 8Volume%=R%*(NVolumes%+1)/128-.5:
  595. Volume%<0 Volume%=0
  596. )List_STATE%(Volume_list%)=%1<<Volume%
  597.  Sound_Volume,Volume%(Volume%)
  598. 7:Volumes%(R%)=NVolumes%:
  599. MS_Stave(R%)
  600. R%>=Adj% R%-=Adj%
  601. R%>=0 CHANGED%=
  602. list_set(%001,%101,%111):
  603. new_staves
  604. list_set(%010,%110,%111):
  605. new_staves
  606. list_set(%100,%111,%111):
  607. new_staves
  608. list_set(%010000,%110000,0):
  609. new_staves
  610. list_set(%100000,%110000,0):
  611. new_staves
  612.  O_Entry%
  613. check_window(Score_W%,-2)
  614. open_option(Stave_list%)
  615.  O_Exit%:
  616. close_option
  617.  O_Initialise%
  618. Max_Stave%=3
  619. Li%=2*Vi%
  620. Stave_Height%=Li%*8
  621.  Y_STAVE%(Max_Stave%+2)
  622. STAVE%=0
  623. PERC%=0
  624. 'Stave_list%=
  625. define_list("STAVE",1)
  626. list_item("VOICE:One stave (may be an accompaniment to Keyboard)",&3031)
  627. list_item("KEYBOARD:Two staves (may be accompanied by Voice)",&3031)
  628. list_item("CHORUS:Four staves",&3031)
  629. list_item("",0)
  630. list_item("SINGLE:One percussion line",&3031)
  631. list_item("DOUBLE:Two percussion lines",&3031)
  632. end_list(Stave_list%)
  633. $0List_STATE%(Stave_list%)=PERC%<<4 
  634.  STAVE%+1
  635. .&Score_Width%=S_Width%-B_Width%-Hi%
  636. position_staves
  637. define_window(Hi%,S_Height%-B_Height%+Vi%,Score_Width%,Score_Height%,&F,
  638. ,"The Score",C_Text,C_Menu,C_Stav,C_Bkgd)
  639.  Create_Window,,Window 
  640.  Score_W%
  641. setup_staves
  642. new_staves
  643. S%,P%
  644. S%=(O%(OO%,State%)
  645. P%=O%(OO%,State%)>>4
  646. S%<>STAVE%
  647. P%<>PERC% STAVE%=S%:PERC%=P%:
  648. setup_score
  649. setup_score
  650. S%,P%
  651. setup_staves
  652. 7:S_C%(S%)=Stave_Channels%(STAVE%,S%):
  653. ?P%=0:
  654. P%<PERC%:P%+=1:S_C%(7-(2-P%)*(5-STAVE%))=STAVE%+P%:
  655. /Instrument%(S%,1)=S_C%(Instrument%(S%,0))+1
  656. sort_instruments
  657. P%=0:
  658. P%,DESCRIBING%
  659. update_item(Instrument_list%,S%,Nth$(Instrument%(S%,1)+(STAVE%-3)*(Instrument%(S%,1)-1>STAVE%))+";")
  660. (HList_Description$(Instrument_list%,S%
  661. 8)=Voice$(Instrument%(S%,2),1)
  662. update_item(Instrument_list%,S%
  663. 8,Voice$(Instrument%(S%,2),0))
  664. <iList_Description$(Instrument_list%,S%
  665. 16)=List_Description$(Volume_list%,Volumes%(Instrument%(S%,0)))
  666. update_item(Instrument_list%,S%
  667. 16,List_Item$(Volume_list%,Volumes%(Instrument%(S%,0))))
  668. P\List_Description$(Instrument_list%,S%
  669. 24)=Stereo$(Stereo_Position%(Instrument%(S%,0)),1)
  670. update_item(Instrument_list%,S%
  671. 24,Stereo$(Stereo_Position%(Instrument%(S%,0)),0))
  672. P%,DESCRIBING%
  673. new_description
  674. MS_Instrument(R%)
  675. r%,S%
  676.     S%=-1
  677. R%>=Adj% R%-=Adj%:S%=1
  678. R%>=0 CHANGED%=
  679. :r%=R%
  680. 8:R%=R%
  681. BInstrument%(r%,2)=(Instrument%(r%,2)+S%+NVoices%-1)
  682. NVoices%+1
  683.  Sound_AttachVoice,r%+1,Instrument%(r%,2)
  684. HList_Description$(Instrument_list%,r%
  685. 8)=Voice$(Instrument%(r%,2),1)
  686. update_item(Instrument_list%,r%
  687. 8,Voice$(Instrument%(r%,2),0))
  688. R%=Instrument%(r%,0)
  689. <Volumes%(R%)=(Volumes%(R%)+S%+NVolumes%+1)
  690. (NVolumes%+1)
  691. ZList_Description$(Instrument_list%,r%
  692. 16)=List_Description$(Volume_list%,Volumes%(R%))
  693. update_item(Instrument_list%,r%
  694. 16,List_Item$(Volume_list%,Volumes%(R%)))
  695. R%=Instrument%(r%,0)
  696. @LStereo_Position%(R%)=(Stereo_Position%(R%)+S%+NStereos%+1)
  697. (NStereos%+1)
  698.  Sound_Stereo,R%+1,Stereo%(Stereo_Position%(R%))
  699. TMList_Description$(Instrument_list%,r%
  700. 24)=Stereo$(Stereo_Position%(R%),1)
  701. update_item(Instrument_list%,r%
  702. 24,Stereo$(Stereo_Position%(R%),0))
  703.  O_Entry%:
  704. open_option(Instrument_list%)
  705.  O_Exit%:
  706. close_option
  707.  O_Initialise%
  708.  Stave_Channels%(Max_Stave%+2,7)
  709.  S%=0 
  710.  Max_Stave%
  711.  R%=0 
  712. &Stave_Channels%(S%,R%)=(S%+1)*R%
  713. Stave_Channels%(2,1)=1
  714. Stave_Channels%(2,2)=1
  715. Stave_Channels%(2,5)=2
  716.  S_C%(7)
  717. 'S_C%(R%)=Stave_Channels%(STAVE%,R%)
  718. I$,L%,M%
  719.  Sound_InstallVoice 
  720.  I$,NVoices%:NVoices%-=1
  721.  Voice$(NVoices%,1)
  722.  Instrument%(7,2)
  723.  Nth$(6)
  724. DyNth$(1)="1st stave":Nth$(2)="2nd stave":Nth$(3)="3rd stave":Nth$(4)="4th stave":Nth$(5)="1st perc":Nth$(6)="2nd perc"
  725. NVoices%
  726.  Sound_InstallVoice,0,R% 
  727.  Voice$(R%,1)
  728. NVoices%
  729. Voice$(R%,1)+" "," ")-1
  730. L%>M% M%=L%
  731. NVoices%-1
  732. L%=R%+1
  733. NVoices%
  734. cut(Voice$(L%,1),M%)=
  735. cut(Voice$(R%,1),M%)
  736. M%<30
  737.     M%+=1
  738. NVoices%
  739. 4Voice$(R%,0)=
  740. cut(Voice$(R%,1),M%)+
  741. M%," "),M%)
  742.  Sound_AttachVoice,R%+1,0 
  743.  L%,S%:
  744. S%>NVoices% S%=1
  745.  Sound_AttachVoice,L%,S%
  746. Instrument%(R%,0)=R%
  747. * Instrument%(R%,1)=S_C%(R%)+1
  748. Instrument%(R%,2)=S%
  749. sort_instruments
  750. R1Instrument_list%=
  751. define_list("INSTRUMENT",4)
  752. f2S%=Instrument%(R%,1):
  753. S%-1>STAVE% S%+=3-STAVE%
  754. list_item(Nth$(S%)+";  ",&371)
  755. S%=Instrument%(R%,2)
  756. list_item(Voice$(S%,0)+":"+Voice$(S%,1),&3131)
  757. list_item(List_Item$(Volume_list%,Volumes%(Instrument%(R%,0)))+":"+List_Description$(Volume_list%,Volumes%(Instrument%(R%,0))),&3131)
  758. NStereos%=6
  759.  Stereo%(NStereos%),Stereo$(NStereos%,1),Stereo_Position%(7)
  760. Stereo$(0,0)="Full left":Stereo$(1,0)="Left":Stereo$(2,0)="Centre left":Stereo$(3,0)="Centre":Stereo$(4,0)="Centre right":Stereo$(5,0)="Right":Stereo$(6,0)="Full right"
  761. NStereos%
  762. &Stereo%(R%)=(2*R%/NStereos%-1)*127
  763. 6Stereo$(R%,1)="Stereo position ("+
  764. Stereo%(R%)+")"
  765. $Stereo_Position%(R%)=NStereos%
  766.  Sound_Stereo,R%+1,Stereo%(Stereo_Position%(R%))
  767. list_item(Stereo$(Stereo_Position%(Instrument%(R%,0)),0)+"      :"+Stereo$(Stereo_Position%(Instrument%(R%,0)),1),&3131)
  768. end_list(Instrument_list%)
  769. L#List_STATE%(Instrument_list%)=0
  770. cut(C$,L%):
  771. I%,S%
  772. S%=I%:I%=
  773. C$," ",S%+1):
  774. I%-1>L%
  775. C$,S%-1) 
  776. C$,L%)
  777. sort_instruments
  778. I%,J%,S%
  779. J%=I%+1
  780.  Instrument%(J%,1)<=Instrument%(I%,1) 
  781.  Instrument%(J%,1)<Instrument%(I%,1) 
  782.  Instrument%(J%,0)<Instrument%(I%,0) 
  783. Instrument%(J%,S%),Instrument%(I%,S%):
  784. MS_Tempo(R%)
  785. R%>=0 
  786. R%=R%
  787. list_set(%1<<R%,&7FFF,&7FFF)
  788. set_tempo(R%)
  789. CHANGED%=
  790.  O_Entry%:
  791. open_option(Tempo_list%)
  792.  O_Exit%:
  793. close_option
  794.  O_Initialise%
  795. NTempos%=14
  796.  Tempo%(NTempos%)
  797. x'Tempo_list%=
  798. define_list("TEMPO",1)
  799. RTempo%(0)=40:
  800. list_item("Larghissimo:Very Slow (40 crotchets a minute)",&3031)
  801. UTempo%(1)=50:
  802. list_item("Largo:Slow and dignified (50 crotchets a minute)",&3031)
  803. TTempo%(2)=60:
  804. list_item("Larghetto:Rather slowly (60 crotchets a minute)",&3031)
  805. ]Tempo%(3)=65:
  806. list_item("Grave:Slow, solemn and dignified (65 crotchets a minute)",&3031)
  807. STempo%(4)=70:
  808. list_item("Adagio:Slow, leisurely (70 crotchets a minute)",&3031)
  809. MTempo%(5)=80:
  810. list_item("Adagietto:Slowly (80 crotchets a minute)",&3031)
  811. QTempo%(6)=90:
  812. list_item("Andante:Walking pace (90 crotchets a minute)",&3031)
  813. OTempo%(7)=100:
  814. list_item("Andantino:Medium (100 crotchets a minute)",&3031)
  815. RTempo%(8)=115:
  816. list_item("Moderato:Moderately (115 crotchets a minute)",&3031)
  817. YTempo%(9)=130:
  818. list_item("Allegretto:Moderately fast (130 crotchets a minute)",&3031)
  819. STempo%(10)=145:
  820. list_item("Allegro:Fast, merry (145 crotchets a minute)",&3031)
  821. STempo%(11)=160:
  822. list_item("Vivace:Fast, lively (160 crotchets a minute)",&3031)
  823. UTempo%(12)=175:
  824. list_item("Veloce:Fast, speedily (175 crotchets a minute)",&3031)
  825. PTempo%(13)=190:
  826. list_item("Presto:Very fast (190 crotchets a minute)",&3031)
  827. VTempo%(14)=210:
  828. list_item("Prestissimo:Extra fast (210 crotchets a minute)",&3031)
  829. end_list(Tempo_list%)
  830. ""List_STATE%(Tempo_list%)=%1<<8
  831. set_tempo(8)
  832. MT_Clef(R%)
  833.  0,1,2,3:
  834. list_set(%1<<R%,%1111,%1111)
  835. check_window(Score_W%,-2)
  836. attach(clef%+R%,%100)
  837.  O_Entry%:
  838. open_option(Clef_list%)
  839.  O_Exit%:
  840. list_set(%10000,%1111,0):
  841. close_option
  842.  O_Initialise%
  843. %Clef_list%=
  844. define_list("CLEF",2)
  845. list_item("clef%:Treble clef",&303A)
  846. list_item("clef%+1:Alto clef",&303A)
  847. list_item("clef%+2:Tenor clef",&303A)
  848. list_item("clef%+3:Bass clef",&303A)
  849. end_list(Clef_list%)
  850. List_STATE%(Clef_list%)=0
  851.     =R%<0
  852. MT_Key(R%)
  853.  0,1:
  854. check_window(Score_W%,-2)
  855. attach(key%,%10)
  856. FONT% 
  857. list_set(%11,%11,%11)
  858.  Adj%+0:KEY_SIG%(1)=(KEY_SIG%(1)+1)
  859. update_item(Key_list%,0,
  860. KEY_SIG%(1))
  861.  Adj%+1:KEY_SIG%(0)=
  862. (KEY_SIG%(0)=0)
  863. new_icon(List_W%(Key_list%),1,S$(accidental%+2+KEY_SIG%(0)))
  864.  O_Entry%:
  865. open_option(Key_list%)
  866.  O_Exit%:
  867. FONT% 
  868. list_set(%100,%111,0)
  869. close_option
  870.  O_Initialise%
  871.  KEY_SIG%(1)
  872.  Key_Y%(3,1,6)
  873.  C%,A%,P%
  874.  C%=0 
  875.  A%=0 
  876.  P%=0 
  877. ZKey_Y%(C%,1-A%,P%)=3*(P%
  878. %1)-P%
  879. 2+(P%-3)*A%+(A%
  880. C%<>2
  881. 5)=0)*7-1-(C%-1>>1)-2*(C%=2)
  882. #Key_list%=
  883. define_list("KEY",2)
  884. list_item("0:Number of accidentals (0-7)",&2171)
  885. list_item("accidental%+2:Type of accidental (Sharp/Flat)",&303A)
  886. end_list(Key_list%)
  887. List_STATE%(Key_list%)=0
  888. R%<0 
  889. KEY_SIG%(1) R%=accidental%+2+KEY_SIG%(0):X%(key%)=(x%(R%)+X%(R%))*KEY_SIG%(1):R%=
  890. X%(key%)=x%(accidental%+2)+X%(accidental%+2)
  891. !*    =R%<0
  892. MT_Time(R%)
  893. check_window(Score_W%,-2)
  894. attach(time%,%1)
  895. FONT% 
  896. list_set(%11,%11,%11)
  897.  Adj%+0:TIME_SIG%(0)=(TIME_SIG%(0)+1)
  898. update_item(Time_list%,0,
  899. (TIME_SIG%(0)+1))
  900.  Adj%+1:TIME_SIG%(1)=(TIME_SIG%(1)-1)
  901. update_item(Time_list%,1,
  902. (1<<TIME_SIG%(1)-1))
  903.  O_Entry%:
  904. open_option(Time_list%)
  905.  O_Exit%:
  906. FONT% 
  907. list_set(%100,%111,0)
  908. close_option
  909.  O_Initialise%
  910.  TIME_SIG%(1)
  911. TIME_SIG%()=3
  912. %Time_list%=
  913. define_list("TIME",1)
  914. list_item("4 :Beats per bar (1-16)",&2179)
  915. list_item("4 :Beat type (2-Minim,4-Crotchet,8-Quaver,16-Semiquaver)",&2179)
  916. end_list(Time_list%)
  917. List_STATE%(Time_list%)=0
  918.     =R%<0
  919. MT_Note(R%)
  920. R%>=0
  921. R%<Adj% 
  922. list_set(%1<<R%,&FFFF,&FFFF)
  923. check_window(Score_W%,-2)
  924. R%<8 
  925. attach(note%+R%,%111000) 
  926. attach(rest%+R%-8,%11000)
  927.  O_Entry%:
  928. open_option(Note_list%)
  929.  O_Exit%:
  930. list_set(&10000,&FFFF,0):
  931. close_option
  932.  O_Initialise%
  933. "~%Note_list%=
  934. define_list("NOTE",4)
  935. list_item("note%:Breve",&303A)
  936. list_item("note%+1:Semibreve",&303A)
  937. list_item("note%+2:Minim",&303A)
  938. list_item("note%+3:Crotchet",&303A)
  939. list_item("note%+4:Quaver",&303A)
  940. list_item("note%+5:Semiquaver",&303A)
  941. list_item("note%+6:Demi-semiquaver",&303A)
  942. list_item("note%+7:Semi-demi-semiquaver",&303A)
  943. list_item("rest%:Breve rest",&303A)
  944. list_item("rest%+1:Semibreve rest",&303A)
  945. list_item("rest%+2:Minim rest",&303A)
  946. list_item("rest%+3:Crotchet rest",&303A)
  947. list_item("rest%+4:Quaver rest",&303A)
  948. list_item("rest%+5:Semiquaver rest",&303A)
  949. list_item("rest%+6:Demi-semiquaver rest",&303A)
  950. list_item("rest%+7:Semi-demi-semiquaver rest",&303A)
  951. end_list(Note_list%)
  952. List_STATE%(Note_list%)=0
  953. #P    =R%<0
  954. MT_Other(R%)
  955. R%>=0
  956. R%<Adj% 
  957. check_window(Score_W%,-2):
  958. list_set(%1<<R%,&3FFF,&3FFF)
  959.  0,1,2,5,6,9,10:
  960. attach(accidental%+R%-R%
  961. 4*2+1,%1100000)
  962.  3,7,11:
  963. attach(dot%+(R%+1)
  964. 4,%1101000)
  965. attach(tie%,%1101000)
  966. attach(bar%,%10010000)
  967.  O_Entry%:
  968. open_option(Other_list%)
  969.  O_Exit%:
  970. list_set(&4000,&3FFF,0):
  971. close_option
  972.  O_Initialise%
  973. 'Other_list%=
  974. define_list("OTHER",3)
  975. list_item("accidental%+1:Natural",&303A)
  976. list_item("accidental%+2:Sharp",&303A)
  977. list_item("accidental%+3:Flat",&303A)
  978. list_item("dot%+1:One dot",&303A)
  979. list_item("tie%:Tie",&303A)
  980. list_item("accidental%+4:Double sharp",&303A)
  981. list_item("accidental%+5:Double flat",&303A)
  982. list_item("dot%+2:Two dots",&303A)
  983. list_item("bar%:Bar line",&303A)
  984. list_item("accidental%+6:Natural sharp",&303A)
  985. list_item("accidental%+7:Natural flat",&303A)
  986. list_item("dot%+3:Three dots",&303A)
  987. end_list(Other_list%)
  988. List_STATE%(Other_list%)=0
  989. $^    =R%<0
  990. MC_Begin(R%)
  991.  O_Entry%
  992. BP%>MUSIC% 
  993. release
  994. start_music
  995. rescore(0)
  996. set_option(M%(MO%),0)
  997. MC_Rewind(R%)
  998. R%=O_Entry% 
  999. BP%>MUSIC% 
  1000. release
  1001. start_bar
  1002. back_bar(1)
  1003. set_option(M%(MO%),0)
  1004. MC_Stop(R%)
  1005.  O_Entry%
  1006. play(
  1007. release
  1008. GP%=PP%:N%()=P%()
  1009. back_bar(3)
  1010. set_option(M%(MO%),0)
  1011. play(P%)
  1012. PLAYING%
  1013.  PLAYING%=
  1014.  Sound_QInit
  1015. MC_Play(R%)
  1016.  O_Entry%
  1017. release
  1018. SCORING%=
  1019. play_start
  1020. set_option(M%(MO%),0)
  1021.  O_Initialise%
  1022. MC_Forward(R%)
  1023.  O_Entry%
  1024. start_bar
  1025. R%=BBAR%+1
  1026. skip_gate:
  1027. BAR%>R%
  1028. GP%=GATE%
  1029. BAR%>R% 
  1030. release
  1031. GP%-=2:BAR%=R%
  1032. set_bar
  1033. rescore(0)
  1034. set_option(M%(MO%),0)
  1035. MC_End(R%)
  1036.  O_Entry%
  1037. release
  1038. GP%=GATE%:N%()=FINE%()
  1039. GP%?-1=Bar%
  1040. GP%?-2=
  1041.  GP%-=2
  1042. back_bar(1)
  1043. set_option(M%(MO%),0)
  1044. MR_Catalogue(R%)
  1045. R%>0 
  1046. R%=R%
  1047. list_set(%1<<R%,
  1048. FILENAME%=R%
  1049. Get_Caret_Position,,Window+handle
  1050. R%=!Icon<>
  1051. Set_Caret_Position,List_W%(Catalogue_list%),R%,,,
  1052. &2000000
  1053. FONT% 
  1054. list_set(1,
  1055. list_set(1,
  1056. FILENAME%=0
  1057.  O_Entry%:
  1058. open_option(Catalogue_list%)
  1059.  O_Exit%:
  1060. close_option
  1061.  O_Initialise%:
  1062. make_catalogue_list
  1063. "List_STATE%(Catalogue_list%)=0
  1064. FILENAME%=0
  1065. make_catalogue_list
  1066. F$,I%,M$,T%,L%,A%,F%
  1067. 0Catalogue_list%=
  1068. define_list("CATALOGUE",-3)
  1069. list_item("          :Specified music file name",&F171)
  1070. get_name(0)
  1071.  F%>=0
  1072. F$=$String_Space%
  1073. OS_File,5,F$ 
  1074.  T%,,,,L%,A%
  1075. L%>8 
  1076. FILE%=
  1077. (Z M$="":
  1078. 7:M$+=
  1079. #FILE%:
  1080. M$="Maestro" 
  1081. list_item(
  1082. F$,11)+":Of length "+
  1083. L%+" bytes",&3031)
  1084. #FILE%:FILE%=
  1085. get_name(F%)
  1086. end_list(Catalogue_list%)
  1087. get_name(N%)
  1088. S%:S%=String_Space%
  1089. "OS_GBPB",9,"",S%,1,N%,256,"*" 
  1090.  ,,,,N%: 
  1091. ?S%:S%+=1:
  1092. :?S%=13: 
  1093. filename:
  1094. FILENAME%>0 
  1095. =List_Item$(Catalogue_list%,FILENAME%) 
  1096. icon_text(List_W%(Catalogue_list%),0)
  1097. new_catalogue
  1098. S%,X%,Y%,U%,F$
  1099. icon_text(List_W%(Catalogue_list%),0)
  1100. *Window!handle=List_W%(Catalogue_list%)
  1101.  Get_Window_State,,Window+handle
  1102. AS%=%1
  1103. Window?status:U%=Window!under:X%=Window!x0:Y%=Window!y1
  1104. redefine_list(Catalogue_list%)
  1105. make_catalogue_list
  1106. move_window(List_W%(Catalogue_list%),X%,Y%,U%)
  1107. )@>S%=
  1108. match_option(List%,Catalogue_list%):
  1109. S% O%(S%,Item%)=
  1110. FILENAME%
  1111. FONT%=
  1112. highlight(List_W%(Catalogue_list%),FILENAME%,
  1113. update_item(Catalogue_list%,0,F$)
  1114. MR_Load(R%)
  1115.  O_Entry%
  1116. CONFIRM%=
  1117.  CHANGED%=
  1118. load_music(
  1119. filename)
  1120. set_option(M%(MO%),0)
  1121. confirm(1)
  1122.  O_Exit%:
  1123. set_option(M%(MO%),0)
  1124. load_music(F$)
  1125. T%,F%,L%,A%,M$
  1126. F%=FILENAME%
  1127. OS_File,5,F$ 
  1128.  T%,,,,L%,A%:F%=(T%=1)
  1129. FILE%=
  1130.  M$="":
  1131. 7:M$+=
  1132. #FILE%:
  1133. #FILE%
  1134. M$="Maestro" 
  1135. #FILE% 
  1136.  0:T%=
  1137. lTempo:
  1138. lInstruments:
  1139. lStaves:
  1140. lMusic
  1141.  File id version 2 and above
  1142. #FILE% 
  1143. lMusic,
  1144. lStaves,
  1145. lInstruments,
  1146. lVolumes,
  1147. lStereos,
  1148. lTempo 
  1149. #FILE%
  1150. list_reset(Tempo_list%,%1<<Tempo%)
  1151. list_reset(Stave_list%,PERC%<<4 
  1152.  STAVE%+1)
  1153. setup_score
  1154. start_music
  1155. rescore(0)
  1156. CHANGED%=
  1157. #FILE%:FILE%=
  1158. lMusic
  1159. C%,B%
  1160. #FILE%,GATE%:GATE%+=MUSIC%
  1161. #FILE%,FINE%(C%):FINE%(C%)+=MUSIC%(C%)
  1162. +f,B%=MUSIC%:
  1163. B%<GATE%:?B%=
  1164. #FILE%:B%+=1:
  1165. +z4B%=MUSIC%(C%):
  1166. B%<FINE%(C%):?B%=
  1167. #FILE%:B%+=1:
  1168. PP%=MUSIC%:P%()=MUSIC%()
  1169. lStaves
  1170. STAVE%=
  1171. #FILE%
  1172. PERC%=
  1173. #FILE%
  1174. lInstruments
  1175. Instrument%(C%,0)=
  1176. #FILE%
  1177. ,Instrument%(C%,2)=(
  1178. #FILE%-1)
  1179. NVoices%+1
  1180.  Sound_AttachVoice,Instrument%(C%,0)+1,Instrument%(C%,2)
  1181. lVolumes
  1182. Volumes%(C%)=
  1183. #FILE%
  1184. lStereos
  1185. ,t Stereo_Position%(C%)=
  1186. #FILE%
  1187.  Sound_Stereo,C%+1,Stereo%(Stereo_Position%(C%))
  1188. lTempo
  1189. set_tempo(
  1190. #FILE%)
  1191. MR_Save(R%)
  1192.  O_Entry%
  1193. F$,A%
  1194. filename
  1195. OS_File,5,F$ 
  1196.  R%,,,,,A%:A%=R%=0
  1197. %1010)=%0010
  1198. CONFIRM%=
  1199.  R%=0 
  1200. save_music(F$)
  1201. set_option(M%(MO%),0)
  1202. new_catalogue
  1203. confirm(2)
  1204. set_option(M%(MO%),0)
  1205.  O_Exit%:
  1206. set_option(M%(MO%),0)
  1207. save_music(F$)
  1208. FILE%=
  1209. #FILE%,"Maestro"
  1210. #FILE%,2
  1211. sMusic
  1212. sStaves
  1213. sInstruments
  1214. sVolumes
  1215. sStereos
  1216. sTempo
  1217. #FILE%:FILE%=
  1218. CHANGED%=
  1219. sMusic
  1220. C%,B%
  1221. #FILE%,1
  1222. #FILE%,GATE%-MUSIC%
  1223. #FILE%,FINE%(C%)-MUSIC%(C%)
  1224. .^,B%=MUSIC%:
  1225. B%<GATE%:
  1226. #FILE%,?B%:B%+=1:
  1227. .r4B%=MUSIC%(C%):
  1228. B%<FINE%(C%):
  1229. #FILE%,?B%:B%+=1:
  1230. sStaves
  1231. #FILE%,2
  1232. #FILE%,STAVE%
  1233. #FILE%,PERC%
  1234. sInstruments
  1235. #FILE%,3
  1236. #FILE%,Instrument%(C%,0)
  1237. #FILE%,Instrument%(C%,2)
  1238. sVolumes
  1239. #FILE%,4
  1240. #FILE%,Volumes%(C%)
  1241. sStereos
  1242. #FILE%,5
  1243. #FILE%,Stereo_Position%(C%)
  1244. sTempo
  1245. #FILE%,6
  1246. #FILE%,Tempo%
  1247. MR_Delete(R%)
  1248.  O_Entry%
  1249. F$,A%
  1250. filename
  1251. OS_File,5,F$ 
  1252.  R%,,,,,A%:A%=R%=1
  1253. %1000)=0
  1254. CONFIRM%=
  1255.  OS_File,6,F$
  1256. set_option(M%(MO%),0)
  1257. new_catalogue
  1258. confirm(3)
  1259. set_option(M%(MO%),0)
  1260.  O_Exit%:
  1261. set_option(M%(MO%),0)
  1262. print(X%,Y%,S$,W%)
  1263. FONT%
  1264. S$>W% 
  1265.  Select_Font,Thin_Font%
  1266.  String_Width,,S$,W%*C_Width%*400,,32,
  1267.  ,,W%,,S%
  1268. Y%+=Vi%
  1269. X%+W%
  1270. 400+4*Hi%*S%,Y%
  1271.  Paint_Chars,,S$,%10101,X%,Y%
  1272. 4,X%,Y%+C_Height%
  1273. sprite(s%,X%,Y%):
  1274. ("SCHOOSE "+S$(s%)):
  1275. 237,X%-x%(s%),Y%-y%(s%):
  1276. float(s%,X%,Y%)
  1277. Window!handle=Score_W%
  1278. Window!x1=X%+X%(s%)
  1279. X%-=x%(s%)
  1280. Window!x0=X%
  1281. Window!y1=Y%+Y%(s%)
  1282. Y%-=y%(s%)
  1283. Window!y0=Y%
  1284.  Update_Window,,Window+handle 
  1285. X%+=Window!x0-Window!scx
  1286. Y%+=Window!y1-Window!scy
  1287. ("SCHOOSE "+S$(s%))
  1288. 3,C_Music:
  1289. key% 
  1290. 237,X%,Y% 
  1291. float_key_sig(X%,Y%+y%(s%))
  1292.  Get_Rectangle,,Window+handle 
  1293. float_key_sig(X%,Y%)
  1294. I%,A%,C%,W%
  1295. KEY_SIG%(1) 
  1296. C%=SCRIBE%(sclef%)
  1297. A%=KEY_SIG%(0)
  1298. I%=accidental%+2+A%
  1299. W%=x%(I%)+X%(I%):Y%-=y%(I%)
  1300. ("SCHOOSE "+S$(I%))
  1301.  I%=0 
  1302.  KEY_SIG%(1)-1
  1303. 237,X%,Y%+Li%*Key_Y%(C%,A%,I%)
  1304. X%+=W%
  1305. 237,X%,Y%-y%(s%)
  1306. start_music
  1307. BP%=MUSIC%
  1308. BBAR%=0
  1309. BP%()=MUSIC%()
  1310. BCLEF%()=0
  1311. BSIG%(0)=%01100111
  1312. BSIG%(1)=%00000010
  1313. start_bar
  1314. start_bar
  1315. GP%=BP%
  1316. BAR%=BBAR%
  1317. N%()=BP%()
  1318. CLEF%()=BCLEF%()
  1319. SIG%()=BSIG%()
  1320. set_bar
  1321. BP%=GP%
  1322. BBAR%=BAR%
  1323. BP%()=N%()
  1324. BCLEF%()=CLEF%()
  1325. BSIG%()=SIG%()
  1326. back_bar(B%)
  1327. GP%>MUSIC%+2 
  1328. PX%,A%,T%
  1329. GP%>MUSIC%+2
  1330. back_gate
  1331. GP%?1
  1332. ?GP%:PX%=
  1333. back_gate:
  1334.     B%-=1
  1335. set_bar
  1336. 1GP%=MUSIC%:BCLEF%()=0:BSIG%(0)=&67:BSIG%(1)=2
  1337. ?GP%=
  1338. GP%-=
  1339. :A%=?GP%
  1340. #T%=%1:
  1341. T%=T%<<%1:
  1342.  Time%,Key%:BSIG%(T%-1)=A%
  1343.  Clef%:BCLEF%(A%>>6)=A%>>3
  1344.  Bar%:BAR%+=1
  1345. GP%-=
  1346. GP%>=BP%
  1347. rescore(0)
  1348. note_type(C%,T%)
  1349. 4D N%(C%)?1=N%(C%)?1
  1350. T%<<5
  1351. note_dots(C%,D%)
  1352. 4b N%(C%)?1=N%(C%)?1
  1353. D%<<3
  1354. note_accidental(C%,A%)
  1355. N%(C%)?1=N%(C%)?1
  1356. note_line(C%,L%)
  1357. !?N%(C%)=?N%(C%)
  1358. (16+L%)<<3
  1359. note_tie(C%,T%)
  1360. "?N%(C%)=?N%(C%)
  1361. (T%<>0)
  1362. note_join(C%,J%)
  1363. "?N%(C%)=?N%(C%)
  1364. (J%<>0)
  1365. note_stem(C%,D%)
  1366. #?N%(C%)=?N%(C%)
  1367. (D%<>0)
  1368. note_clear(C%)
  1369. ?N%(C%)=0:N%(C%)?1=0
  1370. time_sig(N%,B%)
  1371. 54"?GP%=0:GP%?1=Time%
  1372. N%<<1
  1373. B%<<5
  1374. key_sig(A%,N%)
  1375. 5R!?GP%=0:GP%?1=Key%
  1376. A%<<2
  1377. N%<<3
  1378. clef(S%,C%)
  1379. 5p"?GP%=0:GP%?1=Clef%
  1380. C%<<3
  1381. S%<<6
  1382. slur(S%,X%)
  1383. "?GP%=0:GP%?1=Slur%
  1384. X%<<4
  1385. S%<<6
  1386. octave(S%,O%)
  1387. $?GP%=0:GP%?1=Octave%
  1388. O%<<5
  1389. S%<<6
  1390. ?GP%=0:GP%?1=Bar%
  1391. insert_gate(W%)
  1392. GP%<GATE% 
  1393. G%=GATE%-W%
  1394. -4:G%!W%=!G%:
  1395.     G%+=3
  1396. G%>=GP%:G%?W%=?G%:G%+=
  1397. GATE%+=W%
  1398. EP%+=W%
  1399. ?GP%=0:GP%?(W%-1)=0
  1400. insert_note(C%)
  1401. N%(C%)<FINE%(C%) 
  1402. N%=FINE%(C%)-2
  1403. N%(C%)
  1404. -4:N%!2=!N%:
  1405. 6t    N%+=3
  1406. N%>=N%(C%):N%?2=?N%:N%+=
  1407. FINE%(C%)+=2
  1408. ?GP%=?GP%
  1409. %1<<C%
  1410. note_clear(C%)
  1411. delete_gate(W%)
  1412. GATE%-=W%
  1413. GP%<GATE% 
  1414. G%=GP%
  1415. GATE%
  1416. 4:!G%=G%!W%:
  1417. EP%-=W%
  1418. delete_note(C%)
  1419. FINE%(C%)-=2
  1420. N%(C%)<FINE%(C%) 
  1421. N%=N%(C%)
  1422. FINE%(C%)
  1423. 4:!N%=N%!2:
  1424. ?GP%=?GP%
  1425. (%1<<C%)
  1426. allocate_channel(S%)
  1427. C%,c%,G%
  1428. G%=?GP%
  1429. C%=-1:c%=7
  1430. c%>=0
  1431. %1<<c%:c%+=
  1432. c%>=0 
  1433. S_C%(c%)=S% C%=c%
  1434. 7x    c%+=
  1435. arrange_stave(S%)
  1436. C%,B%
  1437. ?GP% 
  1438. GP%+=2:
  1439. GP%>=GATE%
  1440. GP%<GATE%
  1441. C%=C%
  1442. sort_gate
  1443. skip_notes(?GP%):GP%+=1
  1444. ?GP% 
  1445. B%=C%:C%=
  1446. GP%+=2:
  1447. GP%>=GATE%
  1448. sort_gate
  1449. C%,NC%,NN%,G%,g%,pg%,d%,shortest%,Gchanged%
  1450. shortest%=255
  1451. G%=?GP%
  1452. previous_gate(GP%)
  1453. preceding_gate(GP%)
  1454. NC%=-1
  1455. NN%=-1
  1456. S_C%(C%)=S% 
  1457. 8^2NC%+=1:n%(NC%)=C%:
  1458. %1<<C% NN%+=1:C%(NN%)=C%
  1459. %1<<C% d%=N%(C%)?-1>>3
  1460. %11100:
  1461. d%<shortest% shortest%=d%
  1462. shortest%=shortest%
  1463. %11100
  1464. NC%>0
  1465. NN%>=0 
  1466. =Gchanged%
  1467. N%,M%
  1468. c%()=-1
  1469. same_pitch(n%(M%),C%(N%)) c%(N%)=n%(M%)
  1470. c%(N%)<0 c%(N%)=
  1471. C%(N%)=c%(N%) 
  1472. Gchanged%=
  1473. in(c%(N%),C%()):
  1474. M%>N% 
  1475. swap_notes(N%,M%) 
  1476. move_note(N%)
  1477. swap_notes(N%,M%)
  1478. s%,d%
  1479. s%=C%(N%):d%=c%(N%)
  1480. C%(N%),C%(M%)
  1481. ?N%(s%),?N%(d%)
  1482. N%(s%)?1,N%(d%)?1
  1483. move_note(N%)
  1484. s%,d%
  1485. s%=C%(N%):d%=c%(N%)
  1486. insert_note(d%)
  1487. ?N%(d%)=?N%(s%)
  1488. N%(d%)?1=N%(s%)?1
  1489. delete_note(s%)
  1490. N%,C%
  1491.  short%,free%,rest%,any%,tied%
  1492.  N%=NC%
  1493. C%=n%(N%)
  1494. in(C%,c%())<0 
  1495. N%(C%)?-2
  1496. tied%=C%+1
  1497. %1<<C% 
  1498. (N%(C%)?-1>>3)=shortest% short%=C%+1
  1499. N%(C%)?-2
  1500. rest%=C%+1
  1501. free%=C%+1
  1502. any%=C%+1
  1503. short% C%=short% 
  1504. free% C%=free% 
  1505. rest% C%=rest% 
  1506. any% C%=any% 
  1507. C%=tied%
  1508.     =C%-1
  1509. in(U%,U%())
  1510. I%:I%=NN%
  1511. U%<>U%(I%):I%-=1:
  1512. =I%+(U%<>U%(I%))
  1513. same_pitch(c%,C%):
  1514. R%,r%:R%=?N%(C%)
  1515. &F8:r%=N%(c%)?-2
  1516. &F8:=N%(c%)-2>=MUSIC%(c%)
  1517. (N%(c%)?-2
  1518. 4)=4)
  1519. %1<<c%
  1520. preceding_gate(gp%)
  1521. C%,gm%
  1522. S_C%(C%)=S% gm%=gm%
  1523. %1<<C%
  1524. gp%-=1
  1525. gp%<MUSIC%+2
  1526. gp%?-1=
  1527.  =?gp%
  1528. gp%>MUSIC%+1
  1529. gp%?-1<>
  1530. previous_gate(gp%)
  1531. C%,gm%
  1532. S_C%(C%)=S% gm%=gm%
  1533. %1<<C%
  1534. gp%-=1
  1535. gp%>MUSIC%
  1536. gp%?-1=
  1537. :gp%-=2:
  1538. gp%<MUSIC%+2
  1539. =?gp%
  1540. gp%>MUSIC%+1
  1541. conflict(T%,S%,L%)
  1542. C%,co%
  1543. L%+=16
  1544. /co%=?GP%
  1545. %1<<C%
  1546. S_C%(C%)=S%
  1547. (?N%(C%)>>3)=L%
  1548.     C%+=
  1549. =C%-(co%<>0)
  1550. set_score(PX%)
  1551.  PX%(PX%)<Score_Width% 
  1552.  GP%<GATE%
  1553. ?GP% 
  1554. set_notes(?GP%):GP%+=1 
  1555. set_attribute(GP%?1):GP%+=2
  1556. assert(GP%<=GATE%,"Does not overrun music end") 
  1557. EP%=GP%
  1558. EX%=PX%
  1559. &PX%(PX%+1)=PX%(PX%)+PW%(PX%)+Pgap%
  1560. PTYPE%(PX%+1)=Note%
  1561. set_attribute(A%)
  1562. PTYPE%(PX%)+
  1563. PTYPE%(PX%) 
  1564. T%:T%=%1:
  1565. T%=T%<<1:
  1566. <Z&PX%(PX%+1)=PX%(PX%)+PW%(PX%)+Pgap%
  1567. PX%+=1
  1568. PTYPE%(PX%)=T%
  1569. Time%:PW%(PX%)=20*Hi%
  1570. 56 T%=accidental%+(A%>>2
  1571. %1)+2:SIG%(1)=A% 
  1572. T%=accidental%+1:
  1573. A%,SIG%(1):
  1574. A%=8:T%+=1
  1575. &PW%(PX%)=(A%>>3
  1576. 7)*(x%(T%)+X%(T%))
  1577. Clef%:PW%(PX%)=x%(clef%+3)+X%(clef%+3)
  1578. Bar%:PW%(PX%)=Hi%*4
  1579. set_notes(G%)
  1580. x0%,x1%,y0%,y1%
  1581. C%,P%,R%,s%
  1582.     C%=-1
  1583. %1<<C%
  1584. bound_note(!N%(C%))
  1585. x0%>P% P%=x0%
  1586. x1%>R% R%=x1%
  1587. N%(C%)+=2
  1588. (2<<C%)>G%
  1589. =@)PX%(PX%+1)=PX%(PX%)+PW%(PX%)+Pgap%+P%
  1590. PX%+=1
  1591. PW%(PX%)=R%
  1592. PTYPE%(PX%)=Note%
  1593. bound_note(L%)
  1594. H%,S%,s%
  1595. H%=L%>>8
  1596. &F8 S%=H%>>5
  1597. L%<<3
  1598. S%=rest%
  1599. H%>>5
  1600. x0%=x%(S%)
  1601. x1%=X%(S%)
  1602. y0%=y%(S%)
  1603. y1%=Y%(S%)
  1604. s%=accidental%
  1605. x0%+=x%(s%)
  1606. y%(s%)>y0% y0%=y%(s%)
  1607. Y%(s%)>y1% y1%=Y%(s%)
  1608. 24 s%=dot%+(H%>>3
  1609. 3):x1%=x%(S%)+X%(s%):
  1610. y%(s%)>y0% y0%=y%(s%)
  1611. position_staves
  1612.  Y%,S%
  1613. >&8Score_Height%=(PERC%+1+3*(STAVE%+1)+1)*Stave_Height%
  1614. >0%Y%=-Score_Height%-Stave_Height%
  1615. PERC% 
  1616. S%=PERC%
  1617. -1:Y%+=Stave_Height%:Y_STAVE%(STAVE%+S%)=Y%:
  1618.  S%=STAVE%
  1619. -1:Y%+=3*Stave_Height%:Y_STAVE%(S%)=Y%:
  1620. setup_staves
  1621.  H%,O%
  1622. position_staves
  1623. >v)H%=S_Height%-2*(B_Height%-Vi%)-24*Vi%
  1624. Score_Height%<H% H%=Score_Height%
  1625. Window!handle=Score_W%
  1626.  Close_Window,,Window+handle
  1627.  Get_Window_State,,Window+handle
  1628. Window!y1-Window!y0>H% Window!y0=Window!y1-H%
  1629. Window!scx=0:Window!scy=0
  1630.  Open_Window,,Window+handle
  1631. Window!x0=0
  1632. Window!y0=-Score_Height%
  1633. Window!x1=Score_Width%
  1634. Window!y1=0
  1635.  Set_Extent,Score_W%,Window
  1636. update_score(Window!x0,Window!y0,Window!x1,Window!y1)
  1637. Window!handle=Score_W%
  1638.  Update_Window,,Window+handle 
  1639. draw_staves
  1640.  Get_Rectangle,,Window+handle 
  1641. draw_staves
  1642.  Y%,T%,B%,S%,L%
  1643.  x%,y%,x1%
  1644.  c%,t%,b%
  1645. y%=Window!y1-Window!scy
  1646. x%=Window!x0-Window!scx
  1647. 1x1%=x%+Score_Width%:
  1648.  x1%>Clip!x1 x1%=Clip!x1
  1649. #c%=Clip!x0:
  1650. c%<x%+Hi% c%=x%+Hi%
  1651. b%=Clip!y0:t%=Clip!y1
  1652. PERC% 
  1653.  S%=STAVE%+1
  1654. STAVE%+PERC%
  1655. Y%=y%+Y_STAVE%(S%)
  1656. b%<=Y%
  1657. t%>=Y% 
  1658. c%,Y%,x1%,Y%
  1659.  S%=0 
  1660.  STAVE%
  1661. @Y%=y%+Y_STAVE%(S%):T%=Y%+Stave_Height%
  1662. 2:B%=T%-Stave_Height%
  1663. b%<=T%
  1664. t%>=B% 
  1665. c%,Y%,x1%,Y%
  1666. L%=Li%*2
  1667. c%,Y%+L%,x1%,Y%+L%
  1668. c%,Y%-L%,x1%,Y%-L%
  1669. start_bar
  1670. B%=Score_Width%
  1671. T%=Clip!x1-x%:
  1672. T%<B% B%=T%
  1673. T%=Clip!x0-x%:
  1674. T%<0 T%=0
  1675. draw_score(x%,y%,T%,B%)
  1676. draw_score(X%,Y%,A%,B%)
  1677. 1,C_Music
  1678. 1,128+C_Stav
  1679. start_bar
  1680. PX%(PX%+2)<A%
  1681. PX%<EX%
  1682. skip_gate
  1683. PX%(PX%)<B%
  1684. GP%<EP%
  1685. ?GP% 
  1686. draw_notes(?GP%):GP%+=1 
  1687. draw_attribute(GP%?1):GP%+=2
  1688. skip_gate
  1689. ?GP% 
  1690. skip_notes(?GP%):GP%+=1 
  1691. skip_attribute(GP%?1):GP%+=2
  1692. back_gate
  1693. GP%?-2 GP%-=1:
  1694. back_notes(?GP%) 
  1695. GP%-=2:
  1696. back_attribute(GP%?1)
  1697. skip_notes(G%)
  1698. PX%+=1
  1699. C%:C%=
  1700. %1<<C%:N%(C%)+=2:
  1701. (2<<C%)>G%
  1702. back_notes(G%)
  1703. PX%-=1
  1704. C%:C%=
  1705. %1<<C%:N%(C%)-=2:
  1706. (2<<C%)>G%
  1707. draw_notes(G%)
  1708.  C%,x%,y%,s%,l%
  1709. PX%+=1
  1710. x%=X%+PX%(PX%)
  1711.     C%=-1
  1712. %1<<C%
  1713. y%=Y%+Y_STAVE%(S_C%(C%))
  1714. ?N%(C%)
  1715. l%=(?N%(C%)>>3)-16
  1716. l%>5 
  1717. sprite(ledger%+l%
  1718. 2,x%,y%)
  1719. y%+=Li%*l%
  1720. s%=N%(C%)?1>>5
  1721. ?N%(C%)<<3
  1722. sprite(s%,x%,y%)
  1723. N%(C%)?1
  1724. sprite(accidental%
  1725. N%(C%)?1
  1726. 7,x%-x%(s%),y%)
  1727. s%=rest%
  1728. N%(C%)?1>>5
  1729. sprite(s%,x%,y%)
  1730. N%(C%)?1
  1731. sprite(dot%+(N%(C%)?1>>3
  1732. 3),x%+x%(s%),y%)
  1733. ?N%(C%)
  1734. sprite(tie%,x%,y%)
  1735. N%(C%)+=2
  1736. (2<<C%)>G%
  1737. skip_attribute(A%)
  1738. T%:T%=%1:
  1739. T%=T%<<%1:
  1740. Time%,Key%:SIG%(T%-1)=A%
  1741. Clef%:CLEF%(A%>>6)=A%>>3
  1742. Bar%:BAR%+=1
  1743. PTYPE%(PX%) PX%+=1
  1744. back_attribute(A%)
  1745. A%=Bar% BAR%-=1
  1746. PTYPE%(PX%+1)+
  1747. PTYPE%(PX%+1) 
  1748. PX%-=1
  1749. draw_attribute(A%)
  1750. x%,N%
  1751. %1<<N%
  1752. PTYPE%(PX%)
  1753. %1<<N% PX%+=1
  1754. x%=X%+PX%(PX%)
  1755. N%+1 
  1756. draw_time_sig(A%),
  1757. draw_key_sig(A%),
  1758. draw_clef(A%),
  1759. draw_slur(A%),
  1760. draw_octave(A%),
  1761. draw_bar_line(A%)
  1762. draw_time_sig(A%)
  1763. SIG%(0)=A%
  1764. S%,B$,D$,w%
  1765. ((A%>>1
  1766. 15)+1)
  1767. (%1<<(A%>>5)-1)
  1768.     w%=x%
  1769. B$<2 w%+=PW%(PX%)>>2
  1770. D$<2 x%+=PW%(PX%)>>2
  1771. FONT% 
  1772.  Select_Font,Roman_Font%
  1773. STAVE%+PERC%
  1774.  Paint_Chars,,B$,%10100,w%,Y%+Y_STAVE%(S%)+Vi%
  1775.  Paint_Chars,,D$,%10100,x%,Y%+Y_STAVE%(S%)-Li%*4
  1776. STAVE%+PERC%
  1777. w%,Y%+Y_STAVE%(S%)+Li%*4-Vi%:
  1778. x%,Y%+Y_STAVE%(S%)-Vi%:
  1779. draw_key_sig(A%)
  1780. S%,C%,N%,a%,W%
  1781. 56 SIG%(1)=A% 
  1782. A%,SIG%(1):a%=accidental%+1
  1783. N%=(A%>>3
  1784. N%>=0 
  1785. A%=A%>>2
  1786. a%=accidental%+2+A%
  1787. W%=x%(a%)+X%(a%)
  1788. x%+=x%(a%)
  1789.  C%=0 
  1790.  S%=0
  1791. STAVE%
  1792. sprite(a%,x%,Y%+Y_STAVE%(S%)+Li%*Key_Y%(CLEF%(S%),A%,C%))
  1793. x%+=W%
  1794.  S%=0
  1795. STAVE%
  1796. sprite(key%,x%,Y%+Y_STAVE%(S%))
  1797. draw_clef(A%)
  1798. S%=A%>>6
  1799. CLEF%(S%)=A%>>3
  1800. S%<=STAVE% 
  1801. sprite(clef%+CLEF%(S%),x%,Y%+Y_STAVE%(S%))
  1802. draw_slur(A%)
  1803. draw_octave(A%)
  1804. draw_bar_line(A%)
  1805. BAR%+=1
  1806. STAVE%+PERC%
  1807. sprite(bar%,x%,Y%+Y_STAVE%(S%))
  1808. (STAVE%+1)
  1809. x%+Hi%,Y%+Y_STAVE%(STAVE%)+Stave_Height%
  1810. 8y%=Y_STAVE%(STAVE%-1)-Y_STAVE%(STAVE%)-Stave_Height%
  1811. 3,0,y%:
  1812. 0,Hi%,0:
  1813. 3,0,-y%
  1814. put_down
  1815. C%,PX%,X%,Y%,S%,s%
  1816. GP%=SCRIBE%(sgp%)
  1817. 7:N%(C%)=SCRIBE%(C%):
  1818. PX%=SCRIBE%(posx%)
  1819. X%=SCRIBE%(sx%)
  1820. Y%=SCRIBE%(sy%)
  1821. s%=SCRIBE%(sprite%)
  1822. S%=SCRIBE%(stave%)
  1823. C%=SCRIBE%(sc%)
  1824. release
  1825. s%<accidental% 
  1826. put_note 
  1827. s%<clef% 
  1828. put_accidental 
  1829. s%<dot% 
  1830. put_clef 
  1831. s%<bar% 
  1832. put_dot 
  1833. s%<time% 
  1834. put_bar 
  1835. s%<key% 
  1836. put_time 
  1837. s%<tie% 
  1838. put_key 
  1839. put_tie
  1840. GP%=SCRIBE%(sgp%)
  1841. 7:N%(C%)=SCRIBE%(C%):
  1842. arrange_stave(SCRIBE%(stave%))
  1843. CHANGED%=
  1844. put_note
  1845. L%,E%
  1846. L%=SCRIBE%(line%)
  1847. X%=PX%(PX%+1) 
  1848. s%>=rest% L%=-16
  1849. E%=GP%=EP%
  1850. insert_gate(1) 
  1851. conflict(Note%,S%,L%)
  1852. allocate_channel(S%)
  1853. C%>=0 
  1854. insert_note(C%)
  1855. note_type(C%,s%
  1856. s%<rest% 
  1857. note_line(C%,L%):
  1858. note_stem(C%,s%
  1859. s%=!N%(C%)
  1860. set_score(PX%):X%=PX%(PX%+1)
  1861. update_note(S%,s%,X%,Y%)
  1862. s%=!N%(C%)
  1863. delete_note(C%)
  1864. ?GP% 
  1865. update_note(S%,s%,X%,Y%)
  1866. delete_gate(1)
  1867. GP%?-2=0 
  1868. ?GP%=0
  1869. GP%<EP%:
  1870. delete_gate(2):
  1871. rescore(PX%)
  1872. X%>PX%(PX%+1) 
  1873. skip_gate
  1874. insert_gate(1)
  1875. allocate_channel(S%)
  1876. insert_note(C%)
  1877. note_type(C%,s%
  1878. s%<rest% 
  1879. note_line(C%,L%):
  1880. note_stem(C%,s%
  1881. rescore(PX%)
  1882. put_tie
  1883. ?N%(C%)
  1884. note_tie(C%,
  1885. update_score(X%+24,Y%+12,X%+70,Y%+24)
  1886. note_tie(C%,
  1887. skip_notes(?GP%):GP%+=1
  1888. arrange_stave(S%)
  1889. GP%=SCRIBE%(sgp%)
  1890. 7:N%(I%)=SCRIBE%(I%):
  1891. N%(C%)+2>=FINE%(C%)
  1892. (?N%(C%)
  1893. N%(C%)?2)
  1894. note_tie(C%,
  1895. update_score(X%+24,Y%+12,X%+70,Y%+24)
  1896. put_accidental
  1897. A%,a%
  1898. a%=N%(C%)?1
  1899. A%=s%
  1900. A%=a% A%=0
  1901. note_accidental(C%,A%)
  1902. A%*a% 
  1903. update_score(X%-34,Y%-24,X%+16,Y%+52) 
  1904. rescore(PX%)
  1905. put_dot
  1906. D%,d%
  1907. d%=N%(C%)?1>>3
  1908. D%=s%
  1909. D%=d% D%=0
  1910. note_dots(C%,D%)
  1911. D%*d% 
  1912. I*9s%=N%(C%)?1>>5
  1913. ?N%(C%)<<3
  1914. ?N%(C%)
  1915. s%=s%
  1916. rest%
  1917. X%+=x%(s%)
  1918. update_score(X%+24,Y%-8,X%+50,Y%)
  1919. rescore(PX%)
  1920. put_clef
  1921. c%=s%
  1922. GP%=EP%
  1923. (GP%?1
  1924. %111)<>Clef% 
  1925. insert_gate(2)
  1926. clef(S%,c%)
  1927.  ?GP%=0
  1928. (GP%?1
  1929. %111)=Clef%
  1930. (GP%?1>>6)<>S%
  1931. GP%<EP%
  1932. skip_gate
  1933. GP%<EP%
  1934. ?GP%=0
  1935. (GP%?1
  1936. %111)=Clef%
  1937. (GP%?1>>6)=S% 
  1938. (GP%?1>>3
  1939. 3)<>c% 
  1940. clef(S%,c%) 
  1941. delete_gate(2)
  1942. insert_gate(2)
  1943. clef(S%,c%)
  1944. rescore(PX%)
  1945. SCORING%=
  1946. put_key
  1947. GP%=EP%
  1948. (GP%?1
  1949. %11)<>Key% 
  1950. insert_gate(2)
  1951. key_sig(KEY_SIG%(0),KEY_SIG%(1))
  1952. KEY_SIG%(1)>0
  1953. (GP%?1>>2
  1954. %1)<>KEY_SIG%(0)
  1955. (GP%?1>>3)<>KEY_SIG%(1) 
  1956. key_sig(KEY_SIG%(0),KEY_SIG%(1)) 
  1957. delete_gate(2)
  1958. rescore(PX%)
  1959. SCORING%=
  1960. put_time
  1961. GP%=EP%
  1962. (GP%?1
  1963. %1)<>Time% 
  1964. insert_gate(2)
  1965. time_sig(TIME_SIG%(0),TIME_SIG%(1))
  1966. rescore(PX%)
  1967. (GP%?1>>1
  1968. 15)<>TIME_SIG%(0)
  1969. (GP%?1>>5)<>TIME_SIG%(1) 
  1970. time_sig(TIME_SIG%(0),TIME_SIG%(1))
  1971. update_score(X%,-Score_Height%,X%+48,0)
  1972. delete_gate(2)
  1973. rescore(PX%)
  1974. SCORING%=
  1975. put_bar
  1976. (?GP%
  1977. GP%?1<>Bar%)
  1978. X%>PX%(PX%+1)
  1979. GP%<EP% 
  1980. skip_gate 
  1981. GP%?-2=0
  1982. GP%?-1=Bar% 
  1983. back_gate
  1984. GP%>MUSIC% 
  1985. GP%<EP%
  1986. ?GP%=0
  1987. GP%?1=Bar% 
  1988. delete_gate(2)
  1989. ?GP%=0
  1990. GP%<EP%
  1991. delete_gate(2)
  1992. rescore(PX%)
  1993. GP%?-2 
  1994. insert_gate(2):
  1995. rescore(PX%)
  1996. rescore(px%)
  1997. start_bar
  1998. set_score(px%)
  1999. update_score(PX%(px%),-Score_Height%,Score_Width%,0)
  2000. update_note(S%,N%,X%,Y%)
  2001. x0%,x1%,y0%,y1%
  2002. bound_note(N%)
  2003. 4 x1%=X%(tie%):
  2004. Y%(tie%)>y1% y1%=Y%(tie%)
  2005. (Y%-Y_STAVE%(S%))>Li%*5 
  2006. x%(dot%)>x0% x0%=x%(dot%)
  2007. X%(dot%)>x1% x1%=X%(dot%)
  2008. LJ$y1%+=Y%:Y%-=y0%:y0%=Y_STAVE%(S%)
  2009. y1%<y0%-Li%*5 y1%=y0%-Li%*5 
  2010. Y%>y0%+Li%*5 Y%=y0%+Li%*5
  2011. update_score(X%-x0%,Y%,X%+x1%,y1%)
  2012. attach(s%,V%)
  2013. SCRIBE%(sx%)=
  2014. SCRIBE%(drawn%)=
  2015. s%<rest%
  2016. SCRIBE%(sprite%)<rest% s%=s%
  2017. SCRIBE%(sprite%)
  2018. SCRIBE%(sprite%)=s%
  2019. SCRIBE%(valid%)=V%
  2020. SCORING%=
  2021. release
  2022. SCORING%
  2023. SCRIBE%(drawn%) 
  2024. Window:Window=Icon+&200
  2025. float(SCRIBE%(sprite%),SCRIBE%(sx%),SCRIBE%(sy%))
  2026. SCRIBE%(sprite%)<rest% 
  2027. SCRIBE%(line%)>5 
  2028. float(ledger%+SCRIBE%(line%)
  2029. 2,SCRIBE%(sx%),Y_STAVE%(SCRIBE%(stave%)))
  2030. SCRIBE%(sx%)=
  2031. SCRIBE%(drawn%)=
  2032. scribe(X%,Y%)
  2033. S%,L%,C%
  2034. Window!handle=Score_W%
  2035.  Get_Window_State,,Window+handle
  2036. X%-=Window!x0-Window!scx
  2037. Y%-=Window!y1-Window!scy
  2038. proximate(SCRIBE%(valid%))
  2039. X%<>SCRIBE%(sx%)
  2040. Y%<>SCRIBE%(sy%) 
  2041. (SCRIBE%(valid%)
  2042. 112)=96 A%=
  2043. C%>=0 A%=SCRIBE%(valid%)
  2044. S%<=STAVE%
  2045. ?N%(C%)
  2046. SCRIBE%(drawn%) 
  2047. float(SCRIBE%(sprite%),SCRIBE%(sx%),SCRIBE%(sy%))
  2048. SCRIBE%(sprite%)<rest% 
  2049. SCRIBE%(line%)>5 
  2050. float(ledger%+SCRIBE%(line%)
  2051. 2,SCRIBE%(sx%),Y_STAVE%(SCRIBE%(stave%)))
  2052. SCRIBE%(drawn%)=
  2053. SCRIBE%(sprite%)<rest% 
  2054. L%>5 
  2055. float(ledger%+L%
  2056. 2,X%,Y_STAVE%(S%))
  2057. Y%<>SCRIBE%(sy%) SCRIBE%(sprite%)=SCRIBE%(sprite%)
  2058. Y%>SCRIBE%(sy%)
  2059. SCRIBE%(sx%)=X%
  2060. SCRIBE%(sy%)=Y%
  2061. SCRIBE%(stave%)=S%
  2062. S%<=Max_Stave% SCRIBE%(sclef%)=CLEF%(S%) 
  2063. SCRIBE%(sclef%)=CLEF%(Max_Stave%)
  2064. SCRIBE%(line%)=L%
  2065. SCRIBE%(posx%)=PX%
  2066. SCRIBE%(sgp%)=GP%
  2067. SCRIBE%(sc%)=C%
  2068. 7:SCRIBE%(C%)=N%(C%):
  2069. float(SCRIBE%(sprite%),X%,Y%)
  2070. proximate(V%)
  2071. d%,D%
  2072. px%,x%
  2073. start_bar
  2074. D%=2*S_Width%
  2075.     PX%=0
  2076. X%-=X%(clef%)>>1
  2077. T%=-V%<<1
  2078. skip_gate:
  2079. PTYPE%(PX%)
  2080. GP%=EP%
  2081. PTYPE%(PX%)
  2082. Bar% 
  2083. PTYPE%(PX%+1)
  2084. GP%<EP%
  2085. skip_gate:
  2086. GP%=EP%
  2087. GP%?1
  2088. (X%-PX%(PX%+1))
  2089. D%=2*S_Width%
  2090. D%>d%
  2091. GP%=EP%
  2092. d%<D% 
  2093. X%=PX%(PX%+1)
  2094. X%-=X%(2)>>1
  2095. skip_gate
  2096. PTYPE%(PX%+1)
  2097. GP%<EP%:
  2098. skip_gate:
  2099. (X%-PX%(PX%+1))
  2100. D%>d%
  2101. GP%=EP%
  2102. d%<D%
  2103. GP%=EP%
  2104. GP%<EP% 
  2105. X%<PX%(PX%+1)
  2106. X%>PX%(EX%) 
  2107. PTYPE%(PX%) x%=PX%(PX%)+PW%(PX%)-X%(2) 
  2108. x%=PX%(PX%)
  2109. x%=x%+PX%(PX%+1)>>1
  2110. 128 x%+=Hi%*4:
  2111. PTYPE%(PX%)=Bar% x%=PX%(PX%)
  2112. x%=PX%(PX%+1)+PX%(PX%+2)>>1
  2113. 128 x%+=Hi%*4:
  2114. PTYPE%(PX%+2)=Bar% x%=PX%(PX%+2)
  2115. (PX%(PX%+1)-X%)<
  2116. (x%-X%) X%=PX%(PX%+1) 
  2117. X%=x%
  2118. X%=PX%(PX%+1)
  2119. PZ    C%=-1
  2120. ?GP%>0 
  2121. G%,c%
  2122.     c%=C%
  2123. d%=2*S_Height%
  2124. G%=?GP%
  2125. %1<<C%
  2126. D%=Y%-Y_STAVE%(S_C%(C%))
  2127. ?N%(C%)
  2128. &F8 D%=
  2129. (D%-Li%*((?N%(C%)>>3)-16)) 
  2130. D%<d% d%=D%:c%=C%
  2131. (2<<C%)>G%
  2132.     C%=c%
  2133. S%=S_C%(C%)
  2134. ?N%(C%)
  2135. &F8 L%=(?N%(C%)>>3)-16
  2136.  MS%=STAVE%:
  2137. MS%+=PERC%
  2138.     S%=-1
  2139. D%=2*S_Height%
  2140. Q6    d%=D%
  2141. Q@    S%+=1
  2142. (Y%-Y_STAVE%(S%))
  2143. D%>d%
  2144. S%=MS%
  2145. S%+=d%<D%
  2146. S%=STAVE%+1 S%+=Y%>=Y_STAVE%(STAVE%)-Li%*16
  2147. S%<=STAVE% 
  2148. )L%=(Y%-Y_STAVE%(S%))/Li%+16.75:L%-=16
  2149. L%>15 L%=15*
  2150. Y%=Y_STAVE%(S%)+L%*Li%
  2151. savp:n%()=N%():d%=D%:px%=PX%:gp%=GP%:clef%()=CLEF%():sig%()=SIG%():
  2152. rstp:N%()=n%():PX%=px%:GP%=gp%:CLEF%()=clef%():SIG%()=sig%():
  2153. set_tempo(T%)
  2154. Tempo%=T%
  2155.  Sound_QTempo,Tempo%(T%)*128*4096
  2156. play_start
  2157. PBAR%=BBAR%+1
  2158. PP%=BP%+2
  2159. P%()=BP%()
  2160. RD PCLEF%(C%)=Clef%(BCLEF%(C%))
  2161. play_key_sig(BSIG%(1))
  2162. PLAYING%=
  2163.  Sound_QInit
  2164. Rv;Beats%=((BSIG%(0)>>1
  2165. &F)+1)*Length%(BSIG%(0)>>3
  2166. %11100)
  2167. Q%()=Beats%
  2168. TIE%=&FF
  2169. B2%=&10000
  2170.  Sound_QBeat,Beats%
  2171.  Sound_QSchedule,Beats%,Sch%
  2172. Sound_QTempo,Tempo%(Tempo%)*128*4096
  2173. )C%=Beats%/50*&1000:
  2174. C%>&7FFF C%=&7FFF
  2175.  Sound_QTempo,C%
  2176. play_bar
  2177. C%,L%,I%,D%,S%,Q%,T%,B%,A%
  2178. Q%()=Beats%
  2179. B%=PBAR%
  2180. Accidental%()=0
  2181. B%=PBAR%
  2182. PP%<GATE%
  2183. ?PP% 
  2184. play_notes(?PP%):PP%+=1 
  2185. play_attribute(PP%?1):PP%+=2
  2186. PP%>=GATE% PLAYING%=
  2187. play_notes(G%)
  2188. %1<<C%
  2189. Q%(S_C%(C%))>Q% Q%=Q%(S_C%(C%))
  2190. (2<<C%)>G%
  2191. QI%()=&10000:C%=
  2192. %1<<C%
  2193. =T%=?P%(C%):D%=P%(C%)?1:I%=D%>>3:S%=S_C%(C%):L%=T%>>3:A%=0
  2194. S%<=STAVE% 
  2195. 7 Accidental%(S%,L%)=D%
  2196. ;A%=Accidental%(S%,L%):L%+=PCLEF%(S%):
  2197. A%=Key%(L%
  2198. %1<<C% 
  2199. D%=Duration%(Tempo%)?I%:
  2200. 4 TIE%=TIE%
  2201. (%1<<C%):T%=P%(C%)+1:
  2202. T%+=2:D%+=Duration%(Tempo%)?(?T%>>3):
  2203. T%>FINE%(C%)
  2204. D%>254 D%=254
  2205. C%+1,Volume%(Volumes%(C%))
  2206. &100,Line(L%)+Aoff(A%),D%,Q%
  2207. T% TIE%=TIE%
  2208. %1<<C%
  2209. HP%(C%)+=2:
  2210. Length%(I%)<QI%(S%) QI%(S%)=Length%(I%):Q%(S%)=Q%+QI%(S%)
  2211. (2<<C%)>G%
  2212. play_attribute(A%)
  2213. %1<<C%
  2214. C%+1 
  2215. play_time_sig(A%),
  2216. play_key_sig(A%),
  2217. play_clef(A%),
  2218. play_slur(A%),
  2219. play_octave(A%),
  2220. play_bar_line(A%)
  2221. play_time_sig(A%)
  2222. TB+A%=((A%>>1
  2223. &F)+1)*Length%(A%>>3
  2224. %11100)
  2225.  Sound_QSchedule,Beats%,Sch%
  2226. Sound_QBeat,A%
  2227. Beats%=A%
  2228. play_key_sig(A%)
  2229. N%:A%=A%>>2
  2230. 6:Key%(N%)=Key_Sig%(A%,N%):
  2231. play_clef(A%)
  2232.  PCLEF%(A%>>6)=Clef%(A%>>3
  2233. play_slur(A%)
  2234. play_octave(A%)
  2235. play_bar_line(A%)
  2236. PBAR%+=1
  2237. count(S$,C$)
  2238. C%,I%
  2239.     C%=-1
  2240. U(    C%+=1
  2241. S$,C$,I%+1)
  2242. upper(A%):$String_Space%=$A%:
  2243. A%=String_Space%
  2244. String_Space%+
  2245. $String_Space%-1:
  2246. ?A%>96 ?A%-=32
  2247. :=String_Space%
  2248. alphanumeric(C%)
  2249. C%>96 C%-=32
  2250. C%>47
  2251. C%<58
  2252. C%>64
  2253. C%<91 
  2254. bit(M%):
  2255. I%:I%=
  2256. %1<<I%
  2257. initialise
  2258. initialise_miscellany
  2259. initialise_screen
  2260. initialise_font(
  2261. initialise_sprites
  2262. initialise_wimp
  2263. initialise_menu
  2264. initialise_keyboard
  2265. initialise_sound
  2266. initialise_options
  2267. initialise_music
  2268. open_menu(Menu_Root%+1,
  2269. initialise_miscellany
  2270. EXIT%=
  2271. PLAYING%=
  2272.  String_Space% 256
  2273. OS_File=&8
  2274. OS_GBPB=&C
  2275. OS_FSControl=&29
  2276. Sprite$="&.Icons.Music"
  2277.  OS_FSControl,0,"&.UserTunes"
  2278. Host_Dir$="&": 
  2279. Host$="TotalFudge": 
  2280. CHANGED%=
  2281. FILE%=
  2282. initialise_screen
  2283.     Hi%=2
  2284.     Vi%=4
  2285.  S_Width%=1280:S_Height%=1024
  2286. "C_Width%=8*Hi%:C_Height%=8*Vi%
  2287. "S_Columns%=S_Width% 
  2288.  C_Width%
  2289. !S_Rows%=S_Height% 
  2290.  C_Height%
  2291. set_colours
  2292. set_colours
  2293. W0 C_Bkgd=0:
  2294. C_Bkgd,&F0,&E0,&90
  2295. W: C_Text=1:
  2296. C_Text,&80,&30,&10
  2297. WD C_Menu=2:
  2298. C_Menu,&F0,&C0,&80
  2299. WN C_High=3:
  2300. C_High,&00,&B0,&00
  2301. WX C_Stav=4:
  2302. C_Stav,&80,&80,&80
  2303. Wb C_Music=5:
  2304. C_Music,0,  0,  0
  2305.  C%=6
  2306. C%,0,0,0:
  2307. initialise_font(F%)
  2308. FONT%=F%
  2309. FONT% 
  2310. Find_Font=&40081
  2311. Lose_Font=&40082
  2312. String_Width=&40085
  2313. Paint_Chars=&40086
  2314. Select_Font=&4008A
  2315.  Find_Font,,"Thin",160,160 
  2316.  Thin_Font%
  2317.  Find_Font,,"Times.Roman",288,288 
  2318.  Roman_Font%
  2319. 23,25,3,4,6,7,8,10,11,13
  2320. 23,25,128,9,&E0,&D0,&A0,0,0,0
  2321. initialise_sprites
  2322. ("SLOAD "+Sprite$)
  2323.  I%,N%,x%,y%,W%,H%
  2324. X4    N%=-1
  2325. S$<>""
  2326. x%,y%,W%,H%,S$
  2327. X\    N%+=1
  2328. assert(N%>=0,"Sprite data installed") 
  2329.  S$(N%),x%(N%),y%(N%),X%(N%),Y%(N%)
  2330.  S$(I%),x%,y%,W%,H%
  2331. x%(I%)=x%*Hi%
  2332. y%(I%)=y%*Vi%
  2333. X%(I%)=(W%-x%)*Hi%
  2334. Y%(I%)=(H%-y%)*Vi%
  2335. note%=0
  2336. rest%=16
  2337. accidental%=24
  2338. clef%=32
  2339. high%=36
  2340. dot%=44
  2341. ledger%=47
  2342. bar%=48
  2343. time%=55
  2344. key%=56
  2345. tie%=57
  2346.  SL%(N%,1)
  2347. SCORING%=
  2348.  SCRIBE%(18)
  2349. Y`    sx%=8
  2350. Yj    sy%=9
  2351. drawn%=10
  2352. sprite%=11
  2353. valid%=12
  2354. stave%=13
  2355. sclef%=14
  2356. line%=15
  2357. posx%=16
  2358. sgp%=17
  2359. sc%=18
  2360.  B,7,3,26,7,SB,0,2,12,5,Mu,0,2,11,15,Cu,0,2,11,15,Qu,0,2,17,17,SQu,0,2,17,17,DSQu,0,2,17,17,SDSQu,0,2,17,17
  2361.  B,7,3,26,7,SB,0,2,12,5,Md,0,12,11,15,Cd,0,12,11,15,Qd,0,14,11,17,SQd,0,14,11,17,DSQd,0,14,11,17,SDSQd,0,14,11,17
  2362.  Rest,-1,-1,8,4,Rest,-1,-2,8,4,Rest,-1,0,8,4,Rest4,-2,5,7,12,Rest8,-1,4,9,8,Rest16,0,8,11,12,Rest32,1,8,13,16,Rest64,2,12,15,20
  2363.  M,0,2,11,5,Natural,8,6,7,13,Sharp,10,5,9,11,Flat,8,3,7,12,Sharp2,9,2,8,5,Flat2,14,3,13,12,NSharp,17,6,16,13,NFlat,15,6,14,15
  2364.  Treble,0,16,18,31,Alto,0,8,16,19,Alto,0,4,16,19,Bass,0,7,20,17
  2365.  Bh,7,3,26,7,SBh,0,2,12,5,Mh,0,2,11,5,Ch,0,2,11,5
  2366.  ldg5,2,28,15,17,ldg4,2,24,15,13,ldg3,2,20,15,9,ldg2,2,16,15,5,ldg1,2,12,15,1
  2367.  Dot1,-12,2,3,2,Dot2,-12,2,8,2,Dot3,-12,2,13,2,Bar,-1,8,2,17,C,0,2,11,5
  2368.  ldg1,2,-12,15,1,ldg2,2,-12,15,5,ldg3,2,-12,15,9,ldg4,2,-12,15,13,ldg5,2,-12,15,17
  2369.  Time,1,9,25,19,Key,0,13,0,30,Tie,-12,-3,23,3,""
  2370. initialise_wimp
  2371. enumerate_wimp_SWIs
  2372. enumerate_wimp_offsets
  2373.  Initialise
  2374. B_Width%=2*C_Width%+5*Hi%
  2375. B_Height%=C_Height%+4*Vi%
  2376. *POINTER
  2377. Mouse_X%=640:Mouse_Y%=560
  2378. PTIME%=0
  2379. *FX21,9
  2380. redraw_screen
  2381. redraw_screen
  2382.  Force_Redraw,-1,0,0,S_Width%,S_Height%
  2383. enumerate_wimp_SWIs
  2384. W%:W%        = &400C0
  2385. Initialise        = W%+0
  2386. Create_Window     = W%+1
  2387. Create_Icon       = W%+2
  2388. Delete_Window     = W%+3
  2389. Delete_Icon       = W%+4
  2390. Open_Window       = W%+5
  2391. Close_Window      = W%+6
  2392. Poll_Wimp         = W%+7
  2393. Redraw_Window     = W%+8
  2394. Update_Window     = W%+9
  2395. Get_Rectangle     = W%+10
  2396. Get_Window_State  = W%+11
  2397. Get_Window_Info   = W%+12
  2398. Set_Icon_State    = W%+13
  2399. Get_Icon_Info     = W%+14
  2400. Get_Pointer_Info  = W%+15
  2401. Drag_Box          = W%+16
  2402. Force_Redraw      = W%+17
  2403. Set_Caret_Position= W%+18
  2404. Get_Caret_Position= W%+19
  2405. Create_Menu       = W%+20
  2406. Decode_Menu       = W%+21
  2407. Which_Icon        = W%+22
  2408. Set_Extent        = W%+23
  2409. Set_Pointer_Shape = W%+24
  2410. Open_Template     = W%+25
  2411. Close_Template    = W%+26
  2412. Load_Template     = W%+27
  2413. enumerate_wimp_offsets
  2414.  Wimp_Space &500
  2415. Window=Wimp_Space+4
  2416. handle=-4
  2417. x0=0:y0=4:x1=8:y1=12
  2418. scx=16:scy=20
  2419. under=24
  2420. flags=28:status=30
  2421. \X%tFrgd=32:tBkgd=33:Frgd=34:Bkgd=35
  2422. sbo=36:sbi=37
  2423. tHigh=38
  2424. Ex0=40:Ey0=44:Ex1=48:Ey1=52
  2425. title_flags=56
  2426. work_area_flags=60
  2427. sprite_area=64
  2428. title=72
  2429. icons=84
  2430. icon_defs=88
  2431. Icon=Wimp_Space+4
  2432. iflags=16
  2433. Colour=19
  2434. idata=20
  2435. Mouse=Wimp_Space
  2436. buttons=8
  2437. window=12
  2438. icon=16
  2439. old_buttons=20
  2440. colour=23
  2441. state=4
  2442. mask=8
  2443. Clip=Window+24
  2444. key=20
  2445. create_menu_wimp(M%)
  2446.  P%,W%,S%
  2447.  N%,N$
  2448.  X%,I%
  2449. P%=MP%(M%)
  2450. count($P%,Sep$)-1
  2451. $P%-N%*3-2)*C_Width%
  2452. menu_OPTION(
  2453. menu_name(M%))
  2454. S%=C_Width%
  2455. I%=2*B_Width%+
  2456. N$*C_Width%
  2457. I%>W%+N%*S% S%=(I%-W%)
  2458. W%+=N%*S%
  2459. define_window(0,0,W%+Hi%*2,B_Height%+Vi%*2,&13,
  2460. ,N$,C_Text,C_Menu,C_Text,C_Bkgd)
  2461. Window!icons=N%
  2462.  Icon:Icon=Window+icon_defs
  2463.     P%+=4
  2464.  I%=1 
  2465. menu_option(P%)
  2466. N$*C_Width%+S%
  2467. define_icon(X%+Hi%*2,-B_Height%-Vi%,X%+W%,-Vi%,&303D,C_Text,C_Menu,N$)
  2468. Icon+=32
  2469. X%+=W%
  2470.  Create_Window,,Window 
  2471.  Menu_W%(M%)
  2472. create_list_wimp(L%,T$)
  2473.  W%,H%,CW%
  2474.  R%,T%,TH%
  2475.  LI$,F%
  2476.  X%,Y%,I%
  2477. List_Columns%(L%)<0 
  2478. (List_Columns%(L%)=
  2479. List_Columns%(L%)
  2480. List_Items%(L%)/16>List_Columns%(L%) List_Columns%(L%)=List_Items%(L%)
  2481. JList_Item$(L%,0)=
  2482. List_Item$(L%,0)*List_Columns%(L%)/(1-FONT%*2)," ")
  2483. /R%=(List_Items%(L%)-T%)
  2484. List_Columns%(L%)+1
  2485. CW%=String_Space%:!CW%=0
  2486. List_Columns%(L%)
  2487. List_Flag%(L%,(I%-1)*R%+T%)
  2488. %10 F%=0 
  2489. F%=I%
  2490. #W%+=
  2491. max_item_size(L%,F%)
  2492. &FFFF
  2493. CW%!(I%*4)=W%
  2494. X%=2*B_Width%+
  2495. T$*C_Width%
  2496. T% TH%=
  2497. max_item_size(L%,0):H%=TH%
  2498. &FFFF:TH%=(TH%>>16)+Vi%:
  2499. H%>X% X%=H%
  2500.  W%=0 W%=1: 
  2501. X%>W% 
  2502. List_Columns%(L%)*4
  2503. 4:CW%!I%=
  2504. (CW%!I%*X%/W%+2.5)
  2505. (Hi%-1):
  2506. :W%=(X%+2)
  2507. (Hi%-1)
  2508. _2&H%=(
  2509. max_item_size(L%,T%)>>16)+Vi%
  2510. define_window(0,0,W%,TH%+H%*R%,&13,
  2511. ,T$,C_Text,C_Menu,C_Music,C_Bkgd)
  2512. _F"Window!icons=List_Items%(L%)+1
  2513.  Icon:Icon=Window+icon_defs
  2514. List_Select%(L%)=T%
  2515. F%=List_Flag%(L%,0)
  2516. LI$=List_Item$(L%,0)
  2517. &100 X%=
  2518. LI$,"  "):
  2519. X%>0 List_Item$(L%,0)=
  2520. LI$,X%-1)
  2521. define_icon(0,-TH%,W%,-Vi%,F%,C_Music,C_Bkgd,LI$)
  2522. Icon+=32
  2523.     I%=T%
  2524. I%<=List_Items%(L%)
  2525. F%=List_Flag%(L%,I%)
  2526. LI$=List_Item$(L%,I%)
  2527. &100 X%=
  2528. LI$,"  "):
  2529. X%>0 List_Item$(L%,I%)=
  2530. LI$,X%-1)
  2531. &F000 List_Select%(L%)=List_Select%(L%) 
  2532.  %1<<I%
  2533. %10 X%=
  2534. LI$:LI$=S$(X%):SL%(X%,0)=L%:SL%(X%,1)=I%
  2535. X%=(I%-T%)
  2536. Y%=TH%+(I%-T%)
  2537. R%*H%
  2538. define_icon(CW%!X%,-Y%-H%,CW%!(X%+4),-Vi%-Y%,F%,C_Music,C_Bkgd,LI$)
  2539. Icon+=32
  2540.     I%+=1
  2541.  Create_Window,,Window 
  2542.  List_W%(L%)
  2543. max_item_size(L%,C%)
  2544. I%,N%,s%,w%,h%,W%,H%,I$:W%=1:H%=1
  2545. `^/N%=(List_Items%(L%)-T%)
  2546. List_Columns%(L%)+1
  2547. `h!I%=N%*(C%-1)+T%:N%=N%*C%-1+T%
  2548. N%>List_Items%(L%) N%=List_Items%(L%)
  2549. N%=List_Items%(L%)
  2550. I%<=N%
  2551. I$=List_Item$(L%,I%)
  2552. List_Flag%(L%,I%)
  2553. w%=x%(s%)+X%(s%)+Hi%*2
  2554. h%=y%(s%)+Y%(s%)+Vi%*2
  2555. FONT%
  2556. List_Flag%(L%,I%)
  2557.  Select_Font,Roman_Font%
  2558.  String_Width,,I$,S_Width%*400,,32,
  2559.  ,,w%,,s%
  2560. @w%=w%
  2561. (List_Flag%(L%,I%)
  2562. &F000)=&F000 w%+=2*C_Width%*s%
  2563. h%=B_Height%+2*Vi%
  2564. I$+1)*C_Width%
  2565. h%=B_Height%
  2566. w%>W% W%=w%
  2567. h%>H% H%=h%
  2568. aX    I%+=1
  2569. al!W%=W%
  2570. (Hi%-1):H%=H%
  2571. (Vi%-1)
  2572. H%<<16
  2573. define_window(X%,Y%,W%,H%,F%,B%,T$,tf%,tb%,f%,b%)
  2574. $Window=
  2575. =Window!x0=X%:Window!y1=Y%:Window!x1=X%+W%:Window!y0=Y%-H%
  2576.  Window!Ex1=W%:Window!Ey0=-H%
  2577. Window!under=-1
  2578. Window!flags=F%
  2579. %Window?tFrgd=tf%:Window?tBkgd=tb%
  2580. !Window?Frgd=f%:Window?Bkgd=b%
  2581. 'Window!sbo=C_Menu:Window?sbi=C_Text
  2582. window?tHigh=C_High
  2583. Window!title_flags=&3D
  2584. #Window!work_area_flags=B%
  2585. &3000
  2586. $(Window+title)=T$
  2587. define_icon(X0%,Y0%,X1%,Y1%,F%,f%,b%,T$)
  2588. 3Icon!x0=X0%:Icon!y0=Y0%:Icon!x1=X1%:Icon!y1=Y1%
  2589. FONT% 
  2590. F%=F%
  2591. Icon!iflags=F%
  2592. &100 
  2593.  X1% X0%
  2594. T$,"  ")
  2595. Y0% T$=
  2596. T$,Y0%-1)
  2597. $X1%=T$
  2598. Icon!idata=X1%
  2599. Icon!(idata+4)=-1
  2600. Icon!(idata+8)=X0%
  2601. $(Icon+idata)=T$
  2602. &40 Icon?Colour=Roman_Font% 
  2603. Icon?Colour=f%
  2604. b%<<4
  2605. update_item(L%,I%,T$)
  2606. List_Item$(L%,I%)=T$
  2607. update_icon(List_W%(L%),I%,T$)
  2608. new_description
  2609. update_icon(W%,I%,T$)
  2610. Window!handle=W%:!Icon=I%
  2611.  Get_Icon_Info,,Window+handle
  2612. $(Icon!(idata-handle))=T$
  2613. Icon!state=0:Icon!mask=0
  2614.  Set_Icon_State,,Window+handle
  2615. icon_text(W%,I%)
  2616. Window!handle=W%:!Icon=I%
  2617.  Get_Icon_Info,,Window+handle
  2618. =$(Icon!(idata-handle))
  2619. new_icon(W%,I%,T$)
  2620.  H%,F%
  2621. Window!handle=W%:!Icon=I%
  2622.  Get_Icon_Info,,Window+handle
  2623.  Delete_Icon,,Window+handle
  2624. !Window=W%
  2625. $(Icon+idata-handle)=T$
  2626.  Create_Icon,,Icon 
  2627. assert(H%=I%,"Icon handle has not changed") 
  2628. Window!handle=W%:!Icon=I%
  2629. Icon!state=0:Icon!mask=0
  2630.  Set_Icon_State,,Window+handle
  2631. initialise_menu
  2632. Max_Menu%=63
  2633.  MP%(Max_Menu%)
  2634. Sep$=
  2635. Menu_Root%=32
  2636.  Menu_Description$(Max_Menu%)
  2637.  Menu_W%(Max_Menu%)
  2638.  M%(Max_Menu%)
  2639.  Menu_BASE%(Max_Menu%)
  2640. MOP%=0
  2641. dF    MO%=0
  2642. dP Menu_DESCRIPTION%=Menu_Root%
  2643. define_menu_hierarchy
  2644.  Menu_OPTION%(1)
  2645. Max_Option%=31
  2646.  O%(Max_Option%,4)
  2647. .Menu%=0:Option%=1:List%=2:Item%=3:State%=4
  2648.  O$(Max_Option%)
  2649. OOP%=0
  2650.     OO%=0
  2651.     O$=""
  2652.  List_Item$(Max_Option%,Max_Option%)
  2653.  List_Description$(Max_Option%,Max_Option%)
  2654.  List_Items%(Max_Option%)
  2655.  List_Columns%(Max_Option%)
  2656.  List_Flag%(Max_Option%,Max_Option%)
  2657.  List_W%(Max_Option%)
  2658.  List_Select%(Max_Option%)
  2659.  List_STATE%(Max_Option%)
  2660. List_N%=0
  2661. List_W%(0)=0
  2662. List_KEY%=
  2663.  DESCRIPTION%(2)
  2664. DESCRIPTION%(0)=M%(MO%)
  2665. DESCRIPTION%(1)=0
  2666. DESCRIPTION%(2)=0
  2667. O_Initialise%=-1
  2668. O_Entry%=-2
  2669. O_Exit%=-3
  2670. Adj%=64
  2671. define_window(0,0,9*C_Width%,4*C_Height%,&83,
  2672. ,"CONFIRM",C_Text,C_Menu,C_Music,C_High)
  2673.  Create_Window,,Window 
  2674.  Confirm_W%
  2675. CONFIRM%=
  2676. define_menu_hierarchy
  2677. Menu_MAX%=Menu_Root%-1
  2678. define_menu(":Maestro")
  2679. describe_menu("MAESTRO:Music scoring facility by Crosbie Fitch (Ashdown Software Ltd)")
  2680. define_menu("MAESTRO:Help,Setup,Transcribe,Console,Repertoire,eXit")
  2681. describe_menu("HELP:Obtain helpful information about Maestro")
  2682. describe_menu("SETUP:Set music volume, stave structure, instruments to use and tempo")
  2683. describe_menu("TRANSCRIBE:Enter music into Maestro from manuscript")
  2684. describe_menu("CONSOLE:Access control console to play and move about the score")
  2685. describe_menu("REPERTOIRE:Music score filing operations")
  2686. describe_menu("EXIT:Leave Maestro to whence you came")
  2687. define_menu("MAESTRO.HELP:Describe")
  2688. describe_menu("DESCRIBE:Briefly describe indicated items")
  2689. define_menu("MAESTRO.SETUP:Clear,Volume,Stave,Instrument,Tempo")
  2690. describe_menu("CLEAR:Reset music score")
  2691. describe_menu("VOLUME:Set loudness of music")
  2692. describe_menu("STAVE:Set stave structure for music score")
  2693. describe_menu("INSTRUMENT:Set instruments to use for each stave")
  2694. describe_menu("TEMPO:Set speed of music")
  2695. define_menu("MAESTRO.TRANSCRIBE:Clef,Key,Time,Note,Other")
  2696. describe_menu("CLEF:Select a clef")
  2697. describe_menu("KEY:Select a key signature")
  2698. describe_menu("TIME:Select a time signature")
  2699. describe_menu("NOTE:Select notes/rests")
  2700. describe_menu("OTHER:Select an accidental or dots for a note, or a bar")
  2701. define_menu("MAESTRO.CONSOLE:Begin,Rewind,Stop,Play,Forward,End")
  2702. describe_menu("BEGIN:Move to beginning of music score")
  2703. describe_menu("REWIND:Move back to previous bar")
  2704. describe_menu("STOP:Stop music playing and move to that position in the score")
  2705. describe_menu("PLAY:Start music playing from the current position")
  2706. describe_menu("FORWARD:Move forward to next bar")
  2707. describe_menu("END:Move to end of music score")
  2708. define_menu("MAESTRO.REPERTOIRE:Catalogue,Load,Save,Delete")
  2709. describe_menu("CATALOGUE:List titles of music in current repertoire")
  2710. describe_menu("LOAD:Load a music score from the catalogue")
  2711. describe_menu("SAVE:Save the current music score to the catalogue")
  2712. describe_menu("DELETE:Delete a music score from the catalogue")
  2713. define_menu(M$)
  2714. Menu_MAX%+=1
  2715. assert(Menu_MAX%<=Max_Menu%,"Sufficient menu indices") 
  2716.  M%,I%
  2717.  S%,P%
  2718. M$,":")
  2719. assert(I%,"Colon is present in menu definition") 
  2720. I%>1 P%=
  2721. sub_menu(
  2722. M$,I%-1),Menu_MAX%) 
  2723. assert(
  2724. M$>1,"Menu has at least one option") 
  2725. count(M$,",")+1
  2726. assert(S%<11,"Up to 10 menu options") 
  2727. M$-I%+4+S%*2
  2728. MP%(Menu_MAX%)=M%
  2729. ?M%=P%
  2730. M%?1=
  2731.     M%+=2
  2732. M$,I%)
  2733. M$,",",2)
  2734. M$,I%-1)+Sep$
  2735. M%?1=0
  2736. M%+=I%+1
  2737. create_menu_wimp(Menu_MAX%)
  2738. sub_menu(R$,S%)
  2739.  N%,M%,R%,I%
  2740. R$=R$+"."
  2741. N%=Menu_Root%
  2742. M%=MP%(N%)
  2743. R$,".")
  2744. hV'I%=
  2745. upper(M%),
  2746. R$,R%-1)+Sep$,5)-3
  2747. R$,R%+1)
  2748. assert(I%>0,"Menu root is valid") 
  2749. M%?I%
  2750. R$<>"" N%=M%?I%:
  2751. assert(R$="","Menu root is completely defined") 
  2752. assert(M%?I%=
  2753. ,"Destination not already defined") 
  2754. M%?I%=S%
  2755. &=N%:Return number of previous menu
  2756. describe_menu(D$)
  2757.  O%,I%
  2758. assert(
  2759. D$<S_Columns%-1,"Sufficient space to display menu") 
  2760. D$,":",2)
  2761. assert(O%,"Is a menu option") 
  2762. upper(MP%(Menu_MAX%)),
  2763. D$,O%-1)+Sep$,4)-1
  2764. assert(I%>0,"Is a valid menu option and has not already been defined") 
  2765. 'MP%(Menu_MAX%)?I%=Menu_DESCRIPTION%
  2766. 2Menu_Description$(Menu_DESCRIPTION%)=
  2767. D$,O%+1)
  2768. Menu_DESCRIPTION%+=1
  2769. assert(Menu_DESCRIPTION%<=Max_Menu%,"Sufficient description numbers") 
  2770. menu_option(P%)=
  2771. $P%,Sep$)-1)
  2772. menu_OPTION(P%)=
  2773. upper(P%),
  2774. $P%,Sep$)-1)
  2775. menu_name(M%)
  2776. P%=MP%(?MP%(M%))+1
  2777. $P%,Sep$+
  2778. M%)+2
  2779. define_list(T$,C%)
  2780. assert(List_N%>=0,"Previously defined list has been closed") 
  2781. assert(List_N%<Max_Option%,"Sufficient lists allocated") 
  2782. List_Item$(0,0)=T$
  2783. List_N%=-1-List_N%
  2784. List_Items%(-List_N%)=-1
  2785. List_Columns%(-List_N%)=C%
  2786. =-List_N%
  2787. redefine_list(L%)
  2788. List_N%=L%-1
  2789. Window!handle=List_W%(L%)
  2790.  Delete_Window,,Window+handle
  2791. list_item(D$,F%)
  2792.  I%,L%:L%=-List_N%
  2793. assert(L%>0,"List has been opened") 
  2794. assert(List_Items%(L%)<Max_Option%,"Sufficient list options allocated") 
  2795. List_Items%(L%)+=1
  2796. D$,":")
  2797. ,List_Item$(L%,List_Items%(L%))=
  2798. D$,I%-1)
  2799. j"%List_Flag%(L%,List_Items%(L%))=F%
  2800. I% List_Description$(L%,List_Items%(L%))=
  2801. D$,I%+1)
  2802. end_list(L%)
  2803. assert(-List_N%=L%,"Correct list is being closed (& list has been opened)") 
  2804. assert(List_Items%(L%)>=0,"List contains items") 
  2805. assert(List_Items%(L%)+1>=List_Columns%(L%),"There are not more columns than items") 
  2806. create_list_wimp(L%,List_Item$(0,0))
  2807. List_N%=L%
  2808. initialise_options
  2809.  M%,I%,P%
  2810.  M%=Menu_Root% 
  2811.  Menu_MAX%
  2812. P%=MP%(M%)
  2813. $P%,Sep$+
  2814.  I%>2
  2815. P%+=I%
  2816. name_option(M%,P%)
  2817. do_option(O_Initialise%)
  2818. $P%,Sep$+
  2819. initialise_keyboard
  2820. *FX229,1
  2821. *FX4,1
  2822. Imminent_KEY%=0
  2823. initialise_sound
  2824. enumerate_sound_SWIs
  2825.  Sound_Configure,8
  2826.  Sound_Enable
  2827. enumerate_sound_SWIs
  2828.  S0,S1,S2
  2829. "S0                    = &40140
  2830. "S1                    = &40180
  2831. "S2                    = &401C0
  2832. Sound_Configure       = S0
  2833.  Sound_Enable          = S0+1
  2834.  Sound_Stereo          = S0+2
  2835.  Sound_Speaker         = S0+3
  2836. Sound_Volume          = S1
  2837.  Sound_SoundLog        = S1+1
  2838.  Sound_LogScale        = S1+2
  2839.  Sound_InstallVoice    = S1+3
  2840.  Sound_RemoveVoice     = S1+4
  2841.  Sound_AttachVoice     = S1+5
  2842.  Sound_AttachNamedVoice= S1+6
  2843.  Sound_Tuning          = S1+7
  2844.  Sound_Pitch           = S1+8
  2845. l  Sound_Control         = S1+9
  2846. l*!Sound_ControlPacked   = S1+10
  2847. Sound_QInit           = S2
  2848. l> Sound_QSchedule       = S2+1
  2849. lH Sound_QRemove         = S2+2
  2850. lR Sound_QFree           = S2+3
  2851. l\ Sound_QDispatch       = S2+4
  2852. lf Sound_QTempo          = S2+5
  2853. lp Sound_QBeat           = S2+6
  2854. Sch%=&F000000
  2855. initialise_music
  2856. N%,C%
  2857. =Note%=0:Time%=1:Key%=2:Clef%=4:Slur%=8:Octave%=16:Bar%=32
  2858.  Ninc%(6),Line(42),Aoff(7),Clef%(3),Key%(6),Key_Sig%(15,6),Length%(31),Duration%(NTempos%),Accidental%(3,31)
  2859. 6:Ninc%(N%)=
  2860. "024579;",N%+1)
  2861. ST:ST=&1000/12
  2862. ,Line(N%)=(1+N%
  2863. 7<<12)+Ninc%(N%
  2864. 7)*ST+.49
  2865. LAoff(2)=ST:Aoff(3)=-ST:Aoff(4)=ST*2:Aoff(5)=-ST*2:Aoff(6)=ST:Aoff(7)=-ST
  2866. 1Clef%(0)=11:Clef%(1)=5:Clef%(2)=3:Clef%(3)=-1
  2867. (C%>>1)-1
  2868. 0Key_Sig%(C%,(7+Key_Y%(1,C%
  2869. %1,N%))
  2870. 7)=C%
  2871. m88Length%(C%)=(%1<<7-(C%>>2))*(%1111000>>(C%
  2872. %1111)
  2873. NTempos%
  2874.  C% 32:Duration%(N%)=C%
  2875. mt%D%=75/Tempo%(N%)*Length%(C%)/8+.5
  2876. D%>254 D%=254
  2877. Duration%(N%)?C%=D%
  2878. TIE%=&FF
  2879. PLAYING%=
  2880.  Q%(Max_Stave%+2)
  2881.  QI%(Max_Stave%+2)
  2882. B1%=0:B2%=0
  2883.  PX%(128),PW%(128),PTYPE%(128)
  2884.  BP%(7)
  2885.  MUSIC%(7),FINE%(7)
  2886.  N%(7),n%(7)
  2887.  C%(7),c%(7)
  2888.  BCLEF%(Max_Stave%),CLEF%(Max_Stave%),clef%(Max_Stave%)
  2889.  BSIG%(1),SIG%(1),sig%(1)
  2890.  P%(7),PCLEF%(3)
  2891. SPACE%=
  2892. SPACE%-=&4000
  2893. assert(SPACE%>1024,"Sufficient memory available for music storage") 
  2894.  MUSIC% SPACE%+8
  2895. FINE%=MUSIC%+SPACE%
  2896. GATE%=MUSIC%
  2897. nn%MUSIC%(C%)=MUSIC%+(C%+1)*SPACE%/9
  2898. FINE%()=MUSIC%()
  2899. BBAR%=0
  2900. BAR%=0
  2901. PBAR%=0
  2902. start_music
  2903. EP%=GP%
  2904. GATE%+=2
  2905. Pgap%=X%(2)
  2906. PX%(0)=0
  2907. PW%(0)=4*Hi%
  2908. PTYPE%(0)=Bar%
  2909. GP%=MUSIC%
  2910. PP%=MUSIC%
  2911. P%()=MUSIC%()
  2912. set_score(0)
  2913. Set_Caret_Position,
  2914.  OOP%>0
  2915. close_window(List_W%(O%(OOP%,List%)))
  2916. OOP%-=1
  2917.  MOP%>0
  2918. close_window(Menu_W%(M%(MOP%)))
  2919. MOP%-=1
  2920. close_window(Description_W%)
  2921. close_window(Score_W%)
  2922. FONT% 
  2923.  Lose_Font,Thin_Font%
  2924.  Lose_Font,Roman_Font%
  2925. terminate
  2926. *FX229
  2927. *POINTER 0
  2928. 4,20,26,31;31
  2929. assert(E%,A$):
  2930. terminate:
  2931. "ASSERTION FAILED: "+A$:=
  2932. error
  2933. E%,E$
  2934. error2:
  2935. $+" at line "+
  2936. pb&FILE%=FILE%:
  2937. FILE% 
  2938. #FILE%:FILE%=
  2939. error_action
  2940. INITIALISED% 
  2941. save_music("ErrorMUSIC")
  2942.  IFE%=1 ELSEPROCterminate:IFE%<4ANDLENHost$ SYS OS_FSControl,0,Host_Dir$:CHAINHost$ ELSEEND
  2943.  IFE%=1 ELSEPROCterminate:IFE%<4ANDLENHost$ SYS OS_FSControl,0,Host_Dir$:OSCLI("DeskTop")ELSEEND
  2944. INITIALISED% 
  2945. redraw_screen
  2946. error_action
  2947. P%,G%
  2948. *POINTER 0
  2949. 28,18,25,62,7
  2950. 28,20,24,60,8
  2951. '" This error has occurred:"''E$
  2952. '" Enter 1,2,3 or 4 for next action"'
  2953. "  1) Continue program"
  2954. "  2) Save music (as ErrorMUSIC) and exit"
  2955. "  3) Just exit the program"
  2956. "  4) QUIT to system"
  2957. '" :?"
  2958. "1234",
  2959. G%>32
  2960. G%<127 
  2961. G%=13
  2962. *POINTER 1
  2963. error2
  2964. terminate
  2965. "Primary error: "E$
  2966. '"Secondary error: "
  2967. $" at line ";
  2968.